<?xml version="1.0" encoding="ascii"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>xmpp.commands</title>
  <link rel="stylesheet" href="epydoc.css" type="text/css" />
  <script type="text/javascript" src="epydoc.js"></script>
</head>

<body bgcolor="white" text="black" link="blue" vlink="#204080"
      alink="#204080">
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">
  <!-- Home link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="xmpp-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

      <th class="navbar" width="100%"></th>
  </tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0">
  <tr valign="top">
    <td width="100%">
      <span class="breadcrumbs">
        <a href="xmpp-module.html">Package&nbsp;xmpp</a> ::
        Module&nbsp;commands
      </span>
    </td>
    <td>
      <table cellpadding="0" cellspacing="0">
        <!-- hide/show private -->
        <tr><td align="right"><span class="options">[<a href="javascript:void(0);" class="privatelink"
    onclick="toggle_private();">hide&nbsp;private</a>]</span></td></tr>
        <tr><td align="right"><span class="options"
            >[<a href="frames.html" target="_top">frames</a
            >]&nbsp;|&nbsp;<a href="xmpp.commands-pysrc.html"
            target="_top">no&nbsp;frames</a>]</span></td></tr>
      </table>
    </td>
  </tr>
</table>
<h1 class="epydoc">Source Code for <a href="xmpp.commands-module.html">Module xmpp.commands</a></h1>
<pre class="py-src">
<a name="L1"></a><tt class="py-lineno">  1</tt>  <tt class="py-line"><tt class="py-comment">## $Id: commands.py,v 1.17 2007/08/28 09:54:15 normanr Exp $</tt> </tt>
<a name="L2"></a><tt class="py-lineno">  2</tt>  <tt class="py-line"><tt class="py-comment"></tt> </tt>
<a name="L3"></a><tt class="py-lineno">  3</tt>  <tt class="py-line"><tt class="py-comment">## Ad-Hoc Command manager</tt> </tt>
<a name="L4"></a><tt class="py-lineno">  4</tt>  <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment">## Mike Albon (c) 5th January 2005</tt> </tt>
<a name="L5"></a><tt class="py-lineno">  5</tt>  <tt class="py-line"><tt class="py-comment"></tt> </tt>
<a name="L6"></a><tt class="py-lineno">  6</tt>  <tt class="py-line"><tt class="py-comment">##   This program is free software; you can redistribute it and/or modify</tt> </tt>
<a name="L7"></a><tt class="py-lineno">  7</tt>  <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment">##   it under the terms of the GNU General Public License as published by</tt> </tt>
<a name="L8"></a><tt class="py-lineno">  8</tt>  <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment">##   the Free Software Foundation; either version 2, or (at your option)</tt> </tt>
<a name="L9"></a><tt class="py-lineno">  9</tt>  <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment">##   any later version.</tt> </tt>
<a name="L10"></a><tt class="py-lineno"> 10</tt>  <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment">##</tt> </tt>
<a name="L11"></a><tt class="py-lineno"> 11</tt>  <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment">##   This program is distributed in the hope that it will be useful,</tt> </tt>
<a name="L12"></a><tt class="py-lineno"> 12</tt>  <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment">##   but WITHOUT ANY WARRANTY; without even the implied warranty of</tt> </tt>
<a name="L13"></a><tt class="py-lineno"> 13</tt>  <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment">##   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the</tt> </tt>
<a name="L14"></a><tt class="py-lineno"> 14</tt>  <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment">##   GNU General Public License for more details.</tt> </tt>
<a name="L15"></a><tt class="py-lineno"> 15</tt>  <tt class="py-line"><tt class="py-comment"></tt> </tt>
<a name="L16"></a><tt class="py-lineno"> 16</tt>  <tt class="py-line"> </tt>
<a name="L17"></a><tt class="py-lineno"> 17</tt>  <tt class="py-line"><tt class="py-docstring">"""This module is a ad-hoc command processor for xmpppy. It uses the plug-in mechanism like most of the core library. It depends on a DISCO browser manager.</tt> </tt>
<a name="L18"></a><tt class="py-lineno"> 18</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L19"></a><tt class="py-lineno"> 19</tt>  <tt class="py-line"><tt class="py-docstring">There are 3 classes here, a command processor Commands like the Browser, and a command template plugin Command, and an example command.</tt> </tt>
<a name="L20"></a><tt class="py-lineno"> 20</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L21"></a><tt class="py-lineno"> 21</tt>  <tt class="py-line"><tt class="py-docstring">To use this module:</tt> </tt>
<a name="L22"></a><tt class="py-lineno"> 22</tt>  <tt class="py-line"><tt class="py-docstring">    </tt> </tt>
<a name="L23"></a><tt class="py-lineno"> 23</tt>  <tt class="py-line"><tt class="py-docstring">    Instansiate the module with the parent transport and disco browser manager as parameters.</tt> </tt>
<a name="L24"></a><tt class="py-lineno"> 24</tt>  <tt class="py-line"><tt class="py-docstring">    'Plug in' commands using the command template.</tt> </tt>
<a name="L25"></a><tt class="py-lineno"> 25</tt>  <tt class="py-line"><tt class="py-docstring">    The command feature must be added to existing disco replies where neccessary.</tt> </tt>
<a name="L26"></a><tt class="py-lineno"> 26</tt>  <tt class="py-line"><tt class="py-docstring">    </tt> </tt>
<a name="L27"></a><tt class="py-lineno"> 27</tt>  <tt class="py-line"><tt class="py-docstring">What it supplies:</tt> </tt>
<a name="L28"></a><tt class="py-lineno"> 28</tt>  <tt class="py-line"><tt class="py-docstring">    </tt> </tt>
<a name="L29"></a><tt class="py-lineno"> 29</tt>  <tt class="py-line"><tt class="py-docstring">    Automatic command registration with the disco browser manager.</tt> </tt>
<a name="L30"></a><tt class="py-lineno"> 30</tt>  <tt class="py-line"><tt class="py-docstring">    Automatic listing of commands in the public command list.</tt> </tt>
<a name="L31"></a><tt class="py-lineno"> 31</tt>  <tt class="py-line"><tt class="py-docstring">    A means of handling requests, by redirection though the command manager.</tt> </tt>
<a name="L32"></a><tt class="py-lineno"> 32</tt>  <tt class="py-line"><tt class="py-docstring">"""</tt> </tt>
<a name="L33"></a><tt class="py-lineno"> 33</tt>  <tt class="py-line"> </tt>
<a name="L34"></a><tt class="py-lineno"> 34</tt>  <tt class="py-line"><tt class="py-keyword">from</tt> <tt id="link-0" class="py-name" targets="Module xmpp.protocol=xmpp.protocol-module.html"><a title="xmpp.protocol" class="py-name" href="#" onclick="return doclink('link-0', 'protocol', 'link-0');">protocol</a></tt> <tt class="py-keyword">import</tt> <tt class="py-op">*</tt> </tt>
<a name="L35"></a><tt class="py-lineno"> 35</tt>  <tt class="py-line"><tt class="py-keyword">from</tt> <tt id="link-1" class="py-name" targets="Module xmpp.client=xmpp.client-module.html"><a title="xmpp.client" class="py-name" href="#" onclick="return doclink('link-1', 'client', 'link-1');">client</a></tt> <tt class="py-keyword">import</tt> <tt id="link-2" class="py-name" targets="Class xmpp.client.PlugIn=xmpp.client.PlugIn-class.html,Method xmpp.client.PlugIn.PlugIn()=xmpp.client.PlugIn-class.html#PlugIn,Method xmpp.transports.TLS.PlugIn()=xmpp.transports.TLS-class.html#PlugIn"><a title="xmpp.client.PlugIn
xmpp.client.PlugIn.PlugIn
xmpp.transports.TLS.PlugIn" class="py-name" href="#" onclick="return doclink('link-2', 'PlugIn', 'link-2');">PlugIn</a></tt> </tt>
<a name="L36"></a><tt class="py-lineno"> 36</tt>  <tt class="py-line"> </tt>
<a name="Commands"></a><div id="Commands-def"><a name="L37"></a><tt class="py-lineno"> 37</tt> <a class="py-toggle" href="#" id="Commands-toggle" onclick="return toggle('Commands');">-</a><tt class="py-line"><tt class="py-keyword">class</tt> <a class="py-def-name" href="xmpp.commands.Commands-class.html">Commands</a><tt class="py-op">(</tt><tt class="py-base-class">PlugIn</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="Commands-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="Commands-expanded"><a name="L38"></a><tt class="py-lineno"> 38</tt>  <tt class="py-line">    <tt class="py-docstring">"""Commands is an ancestor of PlugIn and can be attached to any session.</tt> </tt>
<a name="L39"></a><tt class="py-lineno"> 39</tt>  <tt class="py-line"><tt class="py-docstring">    </tt> </tt>
<a name="L40"></a><tt class="py-lineno"> 40</tt>  <tt class="py-line"><tt class="py-docstring">    The commands class provides a lookup and browse mechnism. It follows the same priciple of the Browser class, for Service Discovery to provide the list of commands, it adds the 'list' disco type to your existing disco handler function. </tt> </tt>
<a name="L41"></a><tt class="py-lineno"> 41</tt>  <tt class="py-line"><tt class="py-docstring">    </tt> </tt>
<a name="L42"></a><tt class="py-lineno"> 42</tt>  <tt class="py-line"><tt class="py-docstring">    How it works:</tt> </tt>
<a name="L43"></a><tt class="py-lineno"> 43</tt>  <tt class="py-line"><tt class="py-docstring">        The commands are added into the existing Browser on the correct nodes. When the command list is built the supplied discovery handler function needs to have a 'list' option in type. This then gets enumerated, all results returned as None are ignored.</tt> </tt>
<a name="L44"></a><tt class="py-lineno"> 44</tt>  <tt class="py-line"><tt class="py-docstring">        The command executed is then called using it's Execute method. All session management is handled by the command itself.</tt> </tt>
<a name="L45"></a><tt class="py-lineno"> 45</tt>  <tt class="py-line"><tt class="py-docstring">    """</tt> </tt>
<a name="Commands.__init__"></a><div id="Commands.__init__-def"><a name="L46"></a><tt class="py-lineno"> 46</tt> <a class="py-toggle" href="#" id="Commands.__init__-toggle" onclick="return toggle('Commands.__init__');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="xmpp.commands.Commands-class.html#__init__">__init__</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">browser</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="Commands.__init__-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="Commands.__init__-expanded"><a name="L47"></a><tt class="py-lineno"> 47</tt>  <tt class="py-line">        <tt class="py-docstring">"""Initialises class and sets up local variables"""</tt> </tt>
<a name="L48"></a><tt class="py-lineno"> 48</tt>  <tt class="py-line">        <tt id="link-3" class="py-name"><a title="xmpp.client.PlugIn
xmpp.client.PlugIn.PlugIn
xmpp.transports.TLS.PlugIn" class="py-name" href="#" onclick="return doclink('link-3', 'PlugIn', 'link-2');">PlugIn</a></tt><tt class="py-op">.</tt><tt id="link-4" class="py-name" targets="Method xmpp.auth.Bind.__init__()=xmpp.auth.Bind-class.html#__init__,Method xmpp.auth.ComponentBind.__init__()=xmpp.auth.ComponentBind-class.html#__init__,Method xmpp.auth.NonSASL.__init__()=xmpp.auth.NonSASL-class.html#__init__,Method xmpp.auth.SASL.__init__()=xmpp.auth.SASL-class.html#__init__,Method xmpp.browser.Browser.__init__()=xmpp.browser.Browser-class.html#__init__,Method xmpp.client.CommonClient.__init__()=xmpp.client.CommonClient-class.html#__init__,Method xmpp.client.Component.__init__()=xmpp.client.Component-class.html#__init__,Method xmpp.client.PlugIn.__init__()=xmpp.client.PlugIn-class.html#__init__,Method xmpp.commands.Command_Handler_Prototype.__init__()=xmpp.commands.Command_Handler_Prototype-class.html#__init__,Method xmpp.commands.Commands.__init__()=xmpp.commands.Commands-class.html#__init__,Method xmpp.commands.TestCommand.__init__()=xmpp.commands.TestCommand-class.html#__init__,Method xmpp.debug.Debug.__init__()=xmpp.debug.Debug-class.html#__init__,Method xmpp.debug.NoDebug.__init__()=xmpp.debug.NoDebug-class.html#__init__,Method xmpp.dispatcher.Dispatcher.__init__()=xmpp.dispatcher.Dispatcher-class.html#__init__,Method xmpp.filetransfer.IBB.__init__()=xmpp.filetransfer.IBB-class.html#__init__,Method xmpp.protocol.DataField.__init__()=xmpp.protocol.DataField-class.html#__init__,Method xmpp.protocol.DataForm.__init__()=xmpp.protocol.DataForm-class.html#__init__,Method xmpp.protocol.Error.__init__()=xmpp.protocol.Error-class.html#__init__,Method xmpp.protocol.ErrorNode.__init__()=xmpp.protocol.ErrorNode-class.html#__init__,Method xmpp.protocol.Iq.__init__()=xmpp.protocol.Iq-class.html#__init__,Method xmpp.protocol.JID.__init__()=xmpp.protocol.JID-class.html#__init__,Method xmpp.protocol.Message.__init__()=xmpp.protocol.Message-class.html#__init__,Method xmpp.protocol.Presence.__init__()=xmpp.protocol.Presence-class.html#__init__,Method xmpp.protocol.Protocol.__init__()=xmpp.protocol.Protocol-class.html#__init__,Method xmpp.roster.Roster.__init__()=xmpp.roster.Roster-class.html#__init__,Method xmpp.session.Session.__init__()=xmpp.session.Session-class.html#__init__,Method xmpp.simplexml.Node.__init__()=xmpp.simplexml.Node-class.html#__init__,Method xmpp.simplexml.NodeBuilder.__init__()=xmpp.simplexml.NodeBuilder-class.html#__init__,Method xmpp.simplexml.T.__init__()=xmpp.simplexml.T-class.html#__init__,Method xmpp.transports.HTTPPROXYsocket.__init__()=xmpp.transports.HTTPPROXYsocket-class.html#__init__,Method xmpp.transports.TCPsocket.__init__()=xmpp.transports.TCPsocket-class.html#__init__,Method xmpp.transports.error.__init__()=xmpp.transports.error-class.html#__init__"><a title="xmpp.auth.Bind.__init__
xmpp.auth.ComponentBind.__init__
xmpp.auth.NonSASL.__init__
xmpp.auth.SASL.__init__
xmpp.browser.Browser.__init__
xmpp.client.CommonClient.__init__
xmpp.client.Component.__init__
xmpp.client.PlugIn.__init__
xmpp.commands.Command_Handler_Prototype.__init__
xmpp.commands.Commands.__init__
xmpp.commands.TestCommand.__init__
xmpp.debug.Debug.__init__
xmpp.debug.NoDebug.__init__
xmpp.dispatcher.Dispatcher.__init__
xmpp.filetransfer.IBB.__init__
xmpp.protocol.DataField.__init__
xmpp.protocol.DataForm.__init__
xmpp.protocol.Error.__init__
xmpp.protocol.ErrorNode.__init__
xmpp.protocol.Iq.__init__
xmpp.protocol.JID.__init__
xmpp.protocol.Message.__init__
xmpp.protocol.Presence.__init__
xmpp.protocol.Protocol.__init__
xmpp.roster.Roster.__init__
xmpp.session.Session.__init__
xmpp.simplexml.Node.__init__
xmpp.simplexml.NodeBuilder.__init__
xmpp.simplexml.T.__init__
xmpp.transports.HTTPPROXYsocket.__init__
xmpp.transports.TCPsocket.__init__
xmpp.transports.error.__init__" class="py-name" href="#" onclick="return doclink('link-4', '__init__', 'link-4');">__init__</a></tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">)</tt> </tt>
<a name="L49"></a><tt class="py-lineno"> 49</tt>  <tt class="py-line">        <tt class="py-name">DBG_LINE</tt><tt class="py-op">=</tt><tt class="py-string">'commands'</tt> </tt>
<a name="L50"></a><tt class="py-lineno"> 50</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_exported_methods</tt><tt class="py-op">=</tt><tt class="py-op">[</tt><tt class="py-op">]</tt> </tt>
<a name="L51"></a><tt class="py-lineno"> 51</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_handlers</tt><tt class="py-op">=</tt><tt class="py-op">{</tt><tt class="py-string">''</tt><tt class="py-op">:</tt><tt class="py-op">{</tt><tt class="py-op">}</tt><tt class="py-op">}</tt> </tt>
<a name="L52"></a><tt class="py-lineno"> 52</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_browser</tt> <tt class="py-op">=</tt> <tt id="link-5" class="py-name" targets="Module xmpp.browser=xmpp.browser-module.html"><a title="xmpp.browser" class="py-name" href="#" onclick="return doclink('link-5', 'browser', 'link-5');">browser</a></tt> </tt>
</div><a name="L53"></a><tt class="py-lineno"> 53</tt>  <tt class="py-line"> </tt>
<a name="Commands.plugin"></a><div id="Commands.plugin-def"><a name="L54"></a><tt class="py-lineno"> 54</tt> <a class="py-toggle" href="#" id="Commands.plugin-toggle" onclick="return toggle('Commands.plugin');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="xmpp.commands.Commands-class.html#plugin">plugin</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">owner</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="Commands.plugin-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="Commands.plugin-expanded"><a name="L55"></a><tt class="py-lineno"> 55</tt>  <tt class="py-line">        <tt class="py-docstring">"""Makes handlers within the session"""</tt> </tt>
<a name="L56"></a><tt class="py-lineno"> 56</tt>  <tt class="py-line">        <tt class="py-comment"># Plug into the session and the disco manager</tt> </tt>
<a name="L57"></a><tt class="py-lineno"> 57</tt>  <tt class="py-line"><tt class="py-comment"></tt>        <tt class="py-comment"># We only need get and set, results are not needed by a service provider, only a service user.</tt> </tt>
<a name="L58"></a><tt class="py-lineno"> 58</tt>  <tt class="py-line"><tt class="py-comment"></tt>        <tt class="py-name">owner</tt><tt class="py-op">.</tt><tt id="link-6" class="py-name" targets="Method xmpp.dispatcher.Dispatcher.RegisterHandler()=xmpp.dispatcher.Dispatcher-class.html#RegisterHandler"><a title="xmpp.dispatcher.Dispatcher.RegisterHandler" class="py-name" href="#" onclick="return doclink('link-6', 'RegisterHandler', 'link-6');">RegisterHandler</a></tt><tt class="py-op">(</tt><tt class="py-string">'iq'</tt><tt class="py-op">,</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-7" class="py-name" targets="Method xmpp.commands.Commands._CommandHandler()=xmpp.commands.Commands-class.html#_CommandHandler"><a title="xmpp.commands.Commands._CommandHandler" class="py-name" href="#" onclick="return doclink('link-7', '_CommandHandler', 'link-7');">_CommandHandler</a></tt><tt class="py-op">,</tt><tt class="py-name">typ</tt><tt class="py-op">=</tt><tt class="py-string">'set'</tt><tt class="py-op">,</tt><tt class="py-name">ns</tt><tt class="py-op">=</tt><tt id="link-8" class="py-name" targets="Variable xmpp.protocol.NS_COMMANDS=xmpp.protocol-module.html#NS_COMMANDS"><a title="xmpp.protocol.NS_COMMANDS" class="py-name" href="#" onclick="return doclink('link-8', 'NS_COMMANDS', 'link-8');">NS_COMMANDS</a></tt><tt class="py-op">)</tt> </tt>
<a name="L59"></a><tt class="py-lineno"> 59</tt>  <tt class="py-line">        <tt class="py-name">owner</tt><tt class="py-op">.</tt><tt id="link-9" class="py-name"><a title="xmpp.dispatcher.Dispatcher.RegisterHandler" class="py-name" href="#" onclick="return doclink('link-9', 'RegisterHandler', 'link-6');">RegisterHandler</a></tt><tt class="py-op">(</tt><tt class="py-string">'iq'</tt><tt class="py-op">,</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-10" class="py-name"><a title="xmpp.commands.Commands._CommandHandler" class="py-name" href="#" onclick="return doclink('link-10', '_CommandHandler', 'link-7');">_CommandHandler</a></tt><tt class="py-op">,</tt><tt class="py-name">typ</tt><tt class="py-op">=</tt><tt class="py-string">'get'</tt><tt class="py-op">,</tt><tt class="py-name">ns</tt><tt class="py-op">=</tt><tt id="link-11" class="py-name"><a title="xmpp.protocol.NS_COMMANDS" class="py-name" href="#" onclick="return doclink('link-11', 'NS_COMMANDS', 'link-8');">NS_COMMANDS</a></tt><tt class="py-op">)</tt> </tt>
<a name="L60"></a><tt class="py-lineno"> 60</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_browser</tt><tt class="py-op">.</tt><tt id="link-12" class="py-name" targets="Method xmpp.browser.Browser.setDiscoHandler()=xmpp.browser.Browser-class.html#setDiscoHandler"><a title="xmpp.browser.Browser.setDiscoHandler" class="py-name" href="#" onclick="return doclink('link-12', 'setDiscoHandler', 'link-12');">setDiscoHandler</a></tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-13" class="py-name" targets="Method xmpp.commands.Command_Handler_Prototype._DiscoHandler()=xmpp.commands.Command_Handler_Prototype-class.html#_DiscoHandler,Method xmpp.commands.Commands._DiscoHandler()=xmpp.commands.Commands-class.html#_DiscoHandler"><a title="xmpp.commands.Command_Handler_Prototype._DiscoHandler
xmpp.commands.Commands._DiscoHandler" class="py-name" href="#" onclick="return doclink('link-13', '_DiscoHandler', 'link-13');">_DiscoHandler</a></tt><tt class="py-op">,</tt><tt class="py-name">node</tt><tt class="py-op">=</tt><tt id="link-14" class="py-name"><a title="xmpp.protocol.NS_COMMANDS" class="py-name" href="#" onclick="return doclink('link-14', 'NS_COMMANDS', 'link-8');">NS_COMMANDS</a></tt><tt class="py-op">,</tt><tt class="py-name">jid</tt><tt class="py-op">=</tt><tt class="py-string">''</tt><tt class="py-op">)</tt> </tt>
</div><a name="L61"></a><tt class="py-lineno"> 61</tt>  <tt class="py-line">         </tt>
<a name="Commands.plugout"></a><div id="Commands.plugout-def"><a name="L62"></a><tt class="py-lineno"> 62</tt> <a class="py-toggle" href="#" id="Commands.plugout-toggle" onclick="return toggle('Commands.plugout');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="xmpp.commands.Commands-class.html#plugout">plugout</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="Commands.plugout-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="Commands.plugout-expanded"><a name="L63"></a><tt class="py-lineno"> 63</tt>  <tt class="py-line">        <tt class="py-docstring">"""Removes handlers from the session"""</tt> </tt>
<a name="L64"></a><tt class="py-lineno"> 64</tt>  <tt class="py-line">        <tt class="py-comment"># unPlug from the session and the disco manager</tt> </tt>
<a name="L65"></a><tt class="py-lineno"> 65</tt>  <tt class="py-line"><tt class="py-comment"></tt>        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_owner</tt><tt class="py-op">.</tt><tt id="link-15" class="py-name" targets="Method xmpp.dispatcher.Dispatcher.UnregisterHandler()=xmpp.dispatcher.Dispatcher-class.html#UnregisterHandler"><a title="xmpp.dispatcher.Dispatcher.UnregisterHandler" class="py-name" href="#" onclick="return doclink('link-15', 'UnregisterHandler', 'link-15');">UnregisterHandler</a></tt><tt class="py-op">(</tt><tt class="py-string">'iq'</tt><tt class="py-op">,</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-16" class="py-name"><a title="xmpp.commands.Commands._CommandHandler" class="py-name" href="#" onclick="return doclink('link-16', '_CommandHandler', 'link-7');">_CommandHandler</a></tt><tt class="py-op">,</tt><tt class="py-name">ns</tt><tt class="py-op">=</tt><tt id="link-17" class="py-name"><a title="xmpp.protocol.NS_COMMANDS" class="py-name" href="#" onclick="return doclink('link-17', 'NS_COMMANDS', 'link-8');">NS_COMMANDS</a></tt><tt class="py-op">)</tt> </tt>
<a name="L66"></a><tt class="py-lineno"> 66</tt>  <tt class="py-line">        <tt class="py-keyword">for</tt> <tt class="py-name">jid</tt> <tt class="py-keyword">in</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_handlers</tt><tt class="py-op">:</tt> </tt>
<a name="L67"></a><tt class="py-lineno"> 67</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_browser</tt><tt class="py-op">.</tt><tt id="link-18" class="py-name" targets="Method xmpp.browser.Browser.delDiscoHandler()=xmpp.browser.Browser-class.html#delDiscoHandler"><a title="xmpp.browser.Browser.delDiscoHandler" class="py-name" href="#" onclick="return doclink('link-18', 'delDiscoHandler', 'link-18');">delDiscoHandler</a></tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-19" class="py-name"><a title="xmpp.commands.Command_Handler_Prototype._DiscoHandler
xmpp.commands.Commands._DiscoHandler" class="py-name" href="#" onclick="return doclink('link-19', '_DiscoHandler', 'link-13');">_DiscoHandler</a></tt><tt class="py-op">,</tt><tt class="py-name">node</tt><tt class="py-op">=</tt><tt id="link-20" class="py-name"><a title="xmpp.protocol.NS_COMMANDS" class="py-name" href="#" onclick="return doclink('link-20', 'NS_COMMANDS', 'link-8');">NS_COMMANDS</a></tt><tt class="py-op">)</tt> </tt>
</div><a name="L68"></a><tt class="py-lineno"> 68</tt>  <tt class="py-line"> </tt>
<a name="Commands._CommandHandler"></a><div id="Commands._CommandHandler-def"><a name="L69"></a><tt class="py-lineno"> 69</tt> <a class="py-toggle" href="#" id="Commands._CommandHandler-toggle" onclick="return toggle('Commands._CommandHandler');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="xmpp.commands.Commands-class.html#_CommandHandler">_CommandHandler</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt><tt class="py-param">conn</tt><tt class="py-op">,</tt><tt class="py-param">request</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="Commands._CommandHandler-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="Commands._CommandHandler-expanded"><a name="L70"></a><tt class="py-lineno"> 70</tt>  <tt class="py-line">        <tt class="py-docstring">"""The internal method to process the routing of command execution requests"""</tt> </tt>
<a name="L71"></a><tt class="py-lineno"> 71</tt>  <tt class="py-line">        <tt class="py-comment"># This is the command handler itself.</tt> </tt>
<a name="L72"></a><tt class="py-lineno"> 72</tt>  <tt class="py-line"><tt class="py-comment"></tt>        <tt class="py-comment"># We must:</tt> </tt>
<a name="L73"></a><tt class="py-lineno"> 73</tt>  <tt class="py-line"><tt class="py-comment"></tt>        <tt class="py-comment">#   Pass on command execution to command handler</tt> </tt>
<a name="L74"></a><tt class="py-lineno"> 74</tt>  <tt class="py-line"><tt class="py-comment"></tt>        <tt class="py-comment">#   (Do we need to keep session details here, or can that be done in the command?)</tt> </tt>
<a name="L75"></a><tt class="py-lineno"> 75</tt>  <tt class="py-line"><tt class="py-comment"></tt>        <tt class="py-name">jid</tt> <tt class="py-op">=</tt> <tt class="py-name">str</tt><tt class="py-op">(</tt><tt class="py-name">request</tt><tt class="py-op">.</tt><tt id="link-21" class="py-name" targets="Method xmpp.protocol.Protocol.getTo()=xmpp.protocol.Protocol-class.html#getTo"><a title="xmpp.protocol.Protocol.getTo" class="py-name" href="#" onclick="return doclink('link-21', 'getTo', 'link-21');">getTo</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L76"></a><tt class="py-lineno"> 76</tt>  <tt class="py-line">        <tt class="py-keyword">try</tt><tt class="py-op">:</tt> </tt>
<a name="L77"></a><tt class="py-lineno"> 77</tt>  <tt class="py-line">            <tt class="py-name">node</tt> <tt class="py-op">=</tt> <tt class="py-name">request</tt><tt class="py-op">.</tt><tt id="link-22" class="py-name" targets="Method xmpp.simplexml.Node.getTagAttr()=xmpp.simplexml.Node-class.html#getTagAttr"><a title="xmpp.simplexml.Node.getTagAttr" class="py-name" href="#" onclick="return doclink('link-22', 'getTagAttr', 'link-22');">getTagAttr</a></tt><tt class="py-op">(</tt><tt class="py-string">'command'</tt><tt class="py-op">,</tt><tt class="py-string">'node'</tt><tt class="py-op">)</tt> </tt>
<a name="L78"></a><tt class="py-lineno"> 78</tt>  <tt class="py-line">        <tt class="py-keyword">except</tt><tt class="py-op">:</tt> </tt>
<a name="L79"></a><tt class="py-lineno"> 79</tt>  <tt class="py-line">            <tt class="py-name">conn</tt><tt class="py-op">.</tt><tt id="link-23" class="py-name" targets="Method xmpp.dispatcher.Dispatcher.send()=xmpp.dispatcher.Dispatcher-class.html#send,Method xmpp.transports.TCPsocket.send()=xmpp.transports.TCPsocket-class.html#send"><a title="xmpp.dispatcher.Dispatcher.send
xmpp.transports.TCPsocket.send" class="py-name" href="#" onclick="return doclink('link-23', 'send', 'link-23');">send</a></tt><tt class="py-op">(</tt><tt id="link-24" class="py-name" targets="Class xmpp.protocol.Error=xmpp.protocol.Error-class.html"><a title="xmpp.protocol.Error" class="py-name" href="#" onclick="return doclink('link-24', 'Error', 'link-24');">Error</a></tt><tt class="py-op">(</tt><tt class="py-name">request</tt><tt class="py-op">,</tt><tt id="link-25" class="py-name" targets="Variable xmpp.ERR_BAD_REQUEST=xmpp-module.html#ERR_BAD_REQUEST,Variable xmpp.auth.ERR_BAD_REQUEST=xmpp.auth-module.html#ERR_BAD_REQUEST,Variable xmpp.browser.ERR_BAD_REQUEST=xmpp.browser-module.html#ERR_BAD_REQUEST,Variable xmpp.commands.ERR_BAD_REQUEST=xmpp.commands-module.html#ERR_BAD_REQUEST,Variable xmpp.dispatcher.ERR_BAD_REQUEST=xmpp.dispatcher-module.html#ERR_BAD_REQUEST,Variable xmpp.features.ERR_BAD_REQUEST=xmpp.features-module.html#ERR_BAD_REQUEST,Variable xmpp.filetransfer.ERR_BAD_REQUEST=xmpp.filetransfer-module.html#ERR_BAD_REQUEST,Variable xmpp.protocol.ERR_BAD_REQUEST=xmpp.protocol-module.html#ERR_BAD_REQUEST,Variable xmpp.roster.ERR_BAD_REQUEST=xmpp.roster-module.html#ERR_BAD_REQUEST,Variable xmpp.session.ERR_BAD_REQUEST=xmpp.session-module.html#ERR_BAD_REQUEST,Variable xmpp.transports.ERR_BAD_REQUEST=xmpp.transports-module.html#ERR_BAD_REQUEST"><a title="xmpp.ERR_BAD_REQUEST
xmpp.auth.ERR_BAD_REQUEST
xmpp.browser.ERR_BAD_REQUEST
xmpp.commands.ERR_BAD_REQUEST
xmpp.dispatcher.ERR_BAD_REQUEST
xmpp.features.ERR_BAD_REQUEST
xmpp.filetransfer.ERR_BAD_REQUEST
xmpp.protocol.ERR_BAD_REQUEST
xmpp.roster.ERR_BAD_REQUEST
xmpp.session.ERR_BAD_REQUEST
xmpp.transports.ERR_BAD_REQUEST" class="py-name" href="#" onclick="return doclink('link-25', 'ERR_BAD_REQUEST', 'link-25');">ERR_BAD_REQUEST</a></tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L80"></a><tt class="py-lineno"> 80</tt>  <tt class="py-line">            <tt class="py-keyword">raise</tt> <tt id="link-26" class="py-name" targets="Class xmpp.protocol.NodeProcessed=xmpp.protocol.NodeProcessed-class.html"><a title="xmpp.protocol.NodeProcessed" class="py-name" href="#" onclick="return doclink('link-26', 'NodeProcessed', 'link-26');">NodeProcessed</a></tt> </tt>
<a name="L81"></a><tt class="py-lineno"> 81</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_handlers</tt><tt class="py-op">.</tt><tt class="py-name">has_key</tt><tt class="py-op">(</tt><tt class="py-name">jid</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L82"></a><tt class="py-lineno"> 82</tt>  <tt class="py-line">            <tt class="py-keyword">if</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_handlers</tt><tt class="py-op">[</tt><tt class="py-name">jid</tt><tt class="py-op">]</tt><tt class="py-op">.</tt><tt class="py-name">has_key</tt><tt class="py-op">(</tt><tt class="py-name">node</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L83"></a><tt class="py-lineno"> 83</tt>  <tt class="py-line">                <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_handlers</tt><tt class="py-op">[</tt><tt class="py-name">jid</tt><tt class="py-op">]</tt><tt class="py-op">[</tt><tt class="py-name">node</tt><tt class="py-op">]</tt><tt class="py-op">[</tt><tt class="py-string">'execute'</tt><tt class="py-op">]</tt><tt class="py-op">(</tt><tt class="py-name">conn</tt><tt class="py-op">,</tt><tt class="py-name">request</tt><tt class="py-op">)</tt> </tt>
<a name="L84"></a><tt class="py-lineno"> 84</tt>  <tt class="py-line">            <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
<a name="L85"></a><tt class="py-lineno"> 85</tt>  <tt class="py-line">                <tt class="py-name">conn</tt><tt class="py-op">.</tt><tt id="link-27" class="py-name"><a title="xmpp.dispatcher.Dispatcher.send
xmpp.transports.TCPsocket.send" class="py-name" href="#" onclick="return doclink('link-27', 'send', 'link-23');">send</a></tt><tt class="py-op">(</tt><tt id="link-28" class="py-name"><a title="xmpp.protocol.Error" class="py-name" href="#" onclick="return doclink('link-28', 'Error', 'link-24');">Error</a></tt><tt class="py-op">(</tt><tt class="py-name">request</tt><tt class="py-op">,</tt><tt id="link-29" class="py-name" targets="Variable xmpp.ERR_ITEM_NOT_FOUND=xmpp-module.html#ERR_ITEM_NOT_FOUND,Variable xmpp.auth.ERR_ITEM_NOT_FOUND=xmpp.auth-module.html#ERR_ITEM_NOT_FOUND,Variable xmpp.browser.ERR_ITEM_NOT_FOUND=xmpp.browser-module.html#ERR_ITEM_NOT_FOUND,Variable xmpp.commands.ERR_ITEM_NOT_FOUND=xmpp.commands-module.html#ERR_ITEM_NOT_FOUND,Variable xmpp.dispatcher.ERR_ITEM_NOT_FOUND=xmpp.dispatcher-module.html#ERR_ITEM_NOT_FOUND,Variable xmpp.features.ERR_ITEM_NOT_FOUND=xmpp.features-module.html#ERR_ITEM_NOT_FOUND,Variable xmpp.filetransfer.ERR_ITEM_NOT_FOUND=xmpp.filetransfer-module.html#ERR_ITEM_NOT_FOUND,Variable xmpp.protocol.ERR_ITEM_NOT_FOUND=xmpp.protocol-module.html#ERR_ITEM_NOT_FOUND,Variable xmpp.roster.ERR_ITEM_NOT_FOUND=xmpp.roster-module.html#ERR_ITEM_NOT_FOUND,Variable xmpp.session.ERR_ITEM_NOT_FOUND=xmpp.session-module.html#ERR_ITEM_NOT_FOUND,Variable xmpp.transports.ERR_ITEM_NOT_FOUND=xmpp.transports-module.html#ERR_ITEM_NOT_FOUND"><a title="xmpp.ERR_ITEM_NOT_FOUND
xmpp.auth.ERR_ITEM_NOT_FOUND
xmpp.browser.ERR_ITEM_NOT_FOUND
xmpp.commands.ERR_ITEM_NOT_FOUND
xmpp.dispatcher.ERR_ITEM_NOT_FOUND
xmpp.features.ERR_ITEM_NOT_FOUND
xmpp.filetransfer.ERR_ITEM_NOT_FOUND
xmpp.protocol.ERR_ITEM_NOT_FOUND
xmpp.roster.ERR_ITEM_NOT_FOUND
xmpp.session.ERR_ITEM_NOT_FOUND
xmpp.transports.ERR_ITEM_NOT_FOUND" class="py-name" href="#" onclick="return doclink('link-29', 'ERR_ITEM_NOT_FOUND', 'link-29');">ERR_ITEM_NOT_FOUND</a></tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L86"></a><tt class="py-lineno"> 86</tt>  <tt class="py-line">                <tt class="py-keyword">raise</tt> <tt id="link-30" class="py-name"><a title="xmpp.protocol.NodeProcessed" class="py-name" href="#" onclick="return doclink('link-30', 'NodeProcessed', 'link-26');">NodeProcessed</a></tt> </tt>
<a name="L87"></a><tt class="py-lineno"> 87</tt>  <tt class="py-line">        <tt class="py-keyword">elif</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_handlers</tt><tt class="py-op">[</tt><tt class="py-string">''</tt><tt class="py-op">]</tt><tt class="py-op">.</tt><tt class="py-name">has_key</tt><tt class="py-op">(</tt><tt class="py-name">node</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L88"></a><tt class="py-lineno"> 88</tt>  <tt class="py-line">                <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_handlers</tt><tt class="py-op">[</tt><tt class="py-string">''</tt><tt class="py-op">]</tt><tt class="py-op">[</tt><tt class="py-name">node</tt><tt class="py-op">]</tt><tt class="py-op">[</tt><tt class="py-string">'execute'</tt><tt class="py-op">]</tt><tt class="py-op">(</tt><tt class="py-name">conn</tt><tt class="py-op">,</tt><tt class="py-name">request</tt><tt class="py-op">)</tt> </tt>
<a name="L89"></a><tt class="py-lineno"> 89</tt>  <tt class="py-line">        <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
<a name="L90"></a><tt class="py-lineno"> 90</tt>  <tt class="py-line">            <tt class="py-name">conn</tt><tt class="py-op">.</tt><tt id="link-31" class="py-name"><a title="xmpp.dispatcher.Dispatcher.send
xmpp.transports.TCPsocket.send" class="py-name" href="#" onclick="return doclink('link-31', 'send', 'link-23');">send</a></tt><tt class="py-op">(</tt><tt id="link-32" class="py-name"><a title="xmpp.protocol.Error" class="py-name" href="#" onclick="return doclink('link-32', 'Error', 'link-24');">Error</a></tt><tt class="py-op">(</tt><tt class="py-name">request</tt><tt class="py-op">,</tt><tt id="link-33" class="py-name"><a title="xmpp.ERR_ITEM_NOT_FOUND
xmpp.auth.ERR_ITEM_NOT_FOUND
xmpp.browser.ERR_ITEM_NOT_FOUND
xmpp.commands.ERR_ITEM_NOT_FOUND
xmpp.dispatcher.ERR_ITEM_NOT_FOUND
xmpp.features.ERR_ITEM_NOT_FOUND
xmpp.filetransfer.ERR_ITEM_NOT_FOUND
xmpp.protocol.ERR_ITEM_NOT_FOUND
xmpp.roster.ERR_ITEM_NOT_FOUND
xmpp.session.ERR_ITEM_NOT_FOUND
xmpp.transports.ERR_ITEM_NOT_FOUND" class="py-name" href="#" onclick="return doclink('link-33', 'ERR_ITEM_NOT_FOUND', 'link-29');">ERR_ITEM_NOT_FOUND</a></tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L91"></a><tt class="py-lineno"> 91</tt>  <tt class="py-line">            <tt class="py-keyword">raise</tt> <tt id="link-34" class="py-name"><a title="xmpp.protocol.NodeProcessed" class="py-name" href="#" onclick="return doclink('link-34', 'NodeProcessed', 'link-26');">NodeProcessed</a></tt> </tt>
</div><a name="L92"></a><tt class="py-lineno"> 92</tt>  <tt class="py-line"> </tt>
<a name="Commands._DiscoHandler"></a><div id="Commands._DiscoHandler-def"><a name="L93"></a><tt class="py-lineno"> 93</tt> <a class="py-toggle" href="#" id="Commands._DiscoHandler-toggle" onclick="return toggle('Commands._DiscoHandler');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="xmpp.commands.Commands-class.html#_DiscoHandler">_DiscoHandler</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt><tt class="py-param">conn</tt><tt class="py-op">,</tt><tt class="py-param">request</tt><tt class="py-op">,</tt><tt class="py-param">typ</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="Commands._DiscoHandler-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="Commands._DiscoHandler-expanded"><a name="L94"></a><tt class="py-lineno"> 94</tt>  <tt class="py-line">        <tt class="py-docstring">"""The internal method to process service discovery requests"""</tt> </tt>
<a name="L95"></a><tt class="py-lineno"> 95</tt>  <tt class="py-line">        <tt class="py-comment"># This is the disco manager handler.</tt> </tt>
<a name="L96"></a><tt class="py-lineno"> 96</tt>  <tt class="py-line"><tt class="py-comment"></tt>        <tt class="py-keyword">if</tt> <tt class="py-name">typ</tt> <tt class="py-op">==</tt> <tt class="py-string">'items'</tt><tt class="py-op">:</tt> </tt>
<a name="L97"></a><tt class="py-lineno"> 97</tt>  <tt class="py-line">            <tt class="py-comment"># We must:</tt> </tt>
<a name="L98"></a><tt class="py-lineno"> 98</tt>  <tt class="py-line"><tt class="py-comment"></tt>            <tt class="py-comment">#    Generate a list of commands and return the list</tt> </tt>
<a name="L99"></a><tt class="py-lineno"> 99</tt>  <tt class="py-line"><tt class="py-comment"></tt>            <tt class="py-comment">#    * This handler does not handle individual commands disco requests.</tt> </tt>
<a name="L100"></a><tt class="py-lineno">100</tt>  <tt class="py-line"><tt class="py-comment"></tt>            <tt class="py-comment"># Pseudo:</tt> </tt>
<a name="L101"></a><tt class="py-lineno">101</tt>  <tt class="py-line"><tt class="py-comment"></tt>            <tt class="py-comment">#   Enumerate the 'item' disco of each command for the specified jid</tt> </tt>
<a name="L102"></a><tt class="py-lineno">102</tt>  <tt class="py-line"><tt class="py-comment"></tt>            <tt class="py-comment">#   Build responce and send</tt> </tt>
<a name="L103"></a><tt class="py-lineno">103</tt>  <tt class="py-line"><tt class="py-comment"></tt>            <tt class="py-comment">#   To make this code easy to write we add an 'list' disco type, it returns a tuple or 'none' if not advertised</tt> </tt>
<a name="L104"></a><tt class="py-lineno">104</tt>  <tt class="py-line"><tt class="py-comment"></tt>            <tt class="py-name">list</tt> <tt class="py-op">=</tt> <tt class="py-op">[</tt><tt class="py-op">]</tt> </tt>
<a name="L105"></a><tt class="py-lineno">105</tt>  <tt class="py-line">            <tt class="py-name">items</tt> <tt class="py-op">=</tt> <tt class="py-op">[</tt><tt class="py-op">]</tt> </tt>
<a name="L106"></a><tt class="py-lineno">106</tt>  <tt class="py-line">            <tt class="py-name">jid</tt> <tt class="py-op">=</tt> <tt class="py-name">str</tt><tt class="py-op">(</tt><tt class="py-name">request</tt><tt class="py-op">.</tt><tt id="link-35" class="py-name"><a title="xmpp.protocol.Protocol.getTo" class="py-name" href="#" onclick="return doclink('link-35', 'getTo', 'link-21');">getTo</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L107"></a><tt class="py-lineno">107</tt>  <tt class="py-line">            <tt class="py-comment"># Get specific jid based results</tt> </tt>
<a name="L108"></a><tt class="py-lineno">108</tt>  <tt class="py-line"><tt class="py-comment"></tt>            <tt class="py-keyword">if</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_handlers</tt><tt class="py-op">.</tt><tt class="py-name">has_key</tt><tt class="py-op">(</tt><tt class="py-name">jid</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L109"></a><tt class="py-lineno">109</tt>  <tt class="py-line">                <tt class="py-keyword">for</tt> <tt class="py-name">each</tt> <tt class="py-keyword">in</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_handlers</tt><tt class="py-op">[</tt><tt class="py-name">jid</tt><tt class="py-op">]</tt><tt class="py-op">.</tt><tt id="link-36" class="py-name" targets="Method xmpp.roster.Roster.keys()=xmpp.roster.Roster-class.html#keys"><a title="xmpp.roster.Roster.keys" class="py-name" href="#" onclick="return doclink('link-36', 'keys', 'link-36');">keys</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L110"></a><tt class="py-lineno">110</tt>  <tt class="py-line">                    <tt class="py-name">items</tt><tt class="py-op">.</tt><tt class="py-name">append</tt><tt class="py-op">(</tt><tt class="py-op">(</tt><tt class="py-name">jid</tt><tt class="py-op">,</tt><tt class="py-name">each</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L111"></a><tt class="py-lineno">111</tt>  <tt class="py-line">            <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
<a name="L112"></a><tt class="py-lineno">112</tt>  <tt class="py-line">                <tt class="py-comment"># Get generic results</tt> </tt>
<a name="L113"></a><tt class="py-lineno">113</tt>  <tt class="py-line"><tt class="py-comment"></tt>                <tt class="py-keyword">for</tt> <tt class="py-name">each</tt> <tt class="py-keyword">in</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_handlers</tt><tt class="py-op">[</tt><tt class="py-string">''</tt><tt class="py-op">]</tt><tt class="py-op">.</tt><tt id="link-37" class="py-name"><a title="xmpp.roster.Roster.keys" class="py-name" href="#" onclick="return doclink('link-37', 'keys', 'link-36');">keys</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L114"></a><tt class="py-lineno">114</tt>  <tt class="py-line">                    <tt class="py-name">items</tt><tt class="py-op">.</tt><tt class="py-name">append</tt><tt class="py-op">(</tt><tt class="py-op">(</tt><tt class="py-string">''</tt><tt class="py-op">,</tt><tt class="py-name">each</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L115"></a><tt class="py-lineno">115</tt>  <tt class="py-line">            <tt class="py-keyword">if</tt> <tt class="py-name">items</tt> <tt class="py-op">!=</tt> <tt class="py-op">[</tt><tt class="py-op">]</tt><tt class="py-op">:</tt> </tt>
<a name="L116"></a><tt class="py-lineno">116</tt>  <tt class="py-line">                <tt class="py-keyword">for</tt> <tt class="py-name">each</tt> <tt class="py-keyword">in</tt> <tt class="py-name">items</tt><tt class="py-op">:</tt> </tt>
<a name="L117"></a><tt class="py-lineno">117</tt>  <tt class="py-line">                    <tt class="py-name">i</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_handlers</tt><tt class="py-op">[</tt><tt class="py-name">each</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">]</tt><tt class="py-op">]</tt><tt class="py-op">[</tt><tt class="py-name">each</tt><tt class="py-op">[</tt><tt class="py-number">1</tt><tt class="py-op">]</tt><tt class="py-op">]</tt><tt class="py-op">[</tt><tt class="py-string">'disco'</tt><tt class="py-op">]</tt><tt class="py-op">(</tt><tt class="py-name">conn</tt><tt class="py-op">,</tt><tt class="py-name">request</tt><tt class="py-op">,</tt><tt class="py-string">'list'</tt><tt class="py-op">)</tt> </tt>
<a name="L118"></a><tt class="py-lineno">118</tt>  <tt class="py-line">                    <tt class="py-keyword">if</tt> <tt class="py-name">i</tt> <tt class="py-op">!=</tt> <tt class="py-name">None</tt><tt class="py-op">:</tt> </tt>
<a name="L119"></a><tt class="py-lineno">119</tt>  <tt class="py-line">                        <tt class="py-name">list</tt><tt class="py-op">.</tt><tt class="py-name">append</tt><tt class="py-op">(</tt><tt id="link-38" class="py-name" targets="Class xmpp.simplexml.Node=xmpp.simplexml.Node-class.html"><a title="xmpp.simplexml.Node" class="py-name" href="#" onclick="return doclink('link-38', 'Node', 'link-38');">Node</a></tt><tt class="py-op">(</tt><tt class="py-name">tag</tt><tt class="py-op">=</tt><tt class="py-string">'item'</tt><tt class="py-op">,</tt><tt class="py-name">attrs</tt><tt class="py-op">=</tt><tt class="py-op">{</tt><tt class="py-string">'jid'</tt><tt class="py-op">:</tt><tt class="py-name">i</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">]</tt><tt class="py-op">,</tt><tt class="py-string">'node'</tt><tt class="py-op">:</tt><tt class="py-name">i</tt><tt class="py-op">[</tt><tt class="py-number">1</tt><tt class="py-op">]</tt><tt class="py-op">,</tt><tt class="py-string">'name'</tt><tt class="py-op">:</tt><tt class="py-name">i</tt><tt class="py-op">[</tt><tt class="py-number">2</tt><tt class="py-op">]</tt><tt class="py-op">}</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L120"></a><tt class="py-lineno">120</tt>  <tt class="py-line">                <tt class="py-name">iq</tt> <tt class="py-op">=</tt> <tt class="py-name">request</tt><tt class="py-op">.</tt><tt id="link-39" class="py-name" targets="Method xmpp.protocol.Iq.buildReply()=xmpp.protocol.Iq-class.html#buildReply,Method xmpp.protocol.Message.buildReply()=xmpp.protocol.Message-class.html#buildReply"><a title="xmpp.protocol.Iq.buildReply
xmpp.protocol.Message.buildReply" class="py-name" href="#" onclick="return doclink('link-39', 'buildReply', 'link-39');">buildReply</a></tt><tt class="py-op">(</tt><tt class="py-string">'result'</tt><tt class="py-op">)</tt> </tt>
<a name="L121"></a><tt class="py-lineno">121</tt>  <tt class="py-line">                <tt class="py-keyword">if</tt> <tt class="py-name">request</tt><tt class="py-op">.</tt><tt id="link-40" class="py-name" targets="Method xmpp.protocol.Iq.getQuerynode()=xmpp.protocol.Iq-class.html#getQuerynode"><a title="xmpp.protocol.Iq.getQuerynode" class="py-name" href="#" onclick="return doclink('link-40', 'getQuerynode', 'link-40');">getQuerynode</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> <tt class="py-name">iq</tt><tt class="py-op">.</tt><tt id="link-41" class="py-name" targets="Method xmpp.protocol.Iq.setQuerynode()=xmpp.protocol.Iq-class.html#setQuerynode"><a title="xmpp.protocol.Iq.setQuerynode" class="py-name" href="#" onclick="return doclink('link-41', 'setQuerynode', 'link-41');">setQuerynode</a></tt><tt class="py-op">(</tt><tt class="py-name">request</tt><tt class="py-op">.</tt><tt id="link-42" class="py-name"><a title="xmpp.protocol.Iq.getQuerynode" class="py-name" href="#" onclick="return doclink('link-42', 'getQuerynode', 'link-40');">getQuerynode</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L122"></a><tt class="py-lineno">122</tt>  <tt class="py-line">                <tt class="py-name">iq</tt><tt class="py-op">.</tt><tt id="link-43" class="py-name" targets="Method xmpp.protocol.Iq.setQueryPayload()=xmpp.protocol.Iq-class.html#setQueryPayload"><a title="xmpp.protocol.Iq.setQueryPayload" class="py-name" href="#" onclick="return doclink('link-43', 'setQueryPayload', 'link-43');">setQueryPayload</a></tt><tt class="py-op">(</tt><tt class="py-name">list</tt><tt class="py-op">)</tt> </tt>
<a name="L123"></a><tt class="py-lineno">123</tt>  <tt class="py-line">                <tt class="py-name">conn</tt><tt class="py-op">.</tt><tt id="link-44" class="py-name"><a title="xmpp.dispatcher.Dispatcher.send
xmpp.transports.TCPsocket.send" class="py-name" href="#" onclick="return doclink('link-44', 'send', 'link-23');">send</a></tt><tt class="py-op">(</tt><tt class="py-name">iq</tt><tt class="py-op">)</tt> </tt>
<a name="L124"></a><tt class="py-lineno">124</tt>  <tt class="py-line">            <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
<a name="L125"></a><tt class="py-lineno">125</tt>  <tt class="py-line">                <tt class="py-name">conn</tt><tt class="py-op">.</tt><tt id="link-45" class="py-name"><a title="xmpp.dispatcher.Dispatcher.send
xmpp.transports.TCPsocket.send" class="py-name" href="#" onclick="return doclink('link-45', 'send', 'link-23');">send</a></tt><tt class="py-op">(</tt><tt id="link-46" class="py-name"><a title="xmpp.protocol.Error" class="py-name" href="#" onclick="return doclink('link-46', 'Error', 'link-24');">Error</a></tt><tt class="py-op">(</tt><tt class="py-name">request</tt><tt class="py-op">,</tt><tt id="link-47" class="py-name"><a title="xmpp.ERR_ITEM_NOT_FOUND
xmpp.auth.ERR_ITEM_NOT_FOUND
xmpp.browser.ERR_ITEM_NOT_FOUND
xmpp.commands.ERR_ITEM_NOT_FOUND
xmpp.dispatcher.ERR_ITEM_NOT_FOUND
xmpp.features.ERR_ITEM_NOT_FOUND
xmpp.filetransfer.ERR_ITEM_NOT_FOUND
xmpp.protocol.ERR_ITEM_NOT_FOUND
xmpp.roster.ERR_ITEM_NOT_FOUND
xmpp.session.ERR_ITEM_NOT_FOUND
xmpp.transports.ERR_ITEM_NOT_FOUND" class="py-name" href="#" onclick="return doclink('link-47', 'ERR_ITEM_NOT_FOUND', 'link-29');">ERR_ITEM_NOT_FOUND</a></tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L126"></a><tt class="py-lineno">126</tt>  <tt class="py-line">            <tt class="py-keyword">raise</tt> <tt id="link-48" class="py-name"><a title="xmpp.protocol.NodeProcessed" class="py-name" href="#" onclick="return doclink('link-48', 'NodeProcessed', 'link-26');">NodeProcessed</a></tt> </tt>
<a name="L127"></a><tt class="py-lineno">127</tt>  <tt class="py-line">        <tt class="py-keyword">elif</tt> <tt class="py-name">typ</tt> <tt class="py-op">==</tt> <tt class="py-string">'info'</tt><tt class="py-op">:</tt> </tt>
<a name="L128"></a><tt class="py-lineno">128</tt>  <tt class="py-line">            <tt class="py-keyword">return</tt> <tt class="py-op">{</tt><tt class="py-string">'ids'</tt><tt class="py-op">:</tt><tt class="py-op">[</tt><tt class="py-op">{</tt><tt class="py-string">'category'</tt><tt class="py-op">:</tt><tt class="py-string">'automation'</tt><tt class="py-op">,</tt><tt class="py-string">'type'</tt><tt class="py-op">:</tt><tt class="py-string">'command-list'</tt><tt class="py-op">}</tt><tt class="py-op">]</tt><tt class="py-op">,</tt><tt class="py-string">'features'</tt><tt class="py-op">:</tt><tt class="py-op">[</tt><tt class="py-op">]</tt><tt class="py-op">}</tt> </tt>
</div><a name="L129"></a><tt class="py-lineno">129</tt>  <tt class="py-line"> </tt>
<a name="Commands.addCommand"></a><div id="Commands.addCommand-def"><a name="L130"></a><tt class="py-lineno">130</tt> <a class="py-toggle" href="#" id="Commands.addCommand-toggle" onclick="return toggle('Commands.addCommand');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="xmpp.commands.Commands-class.html#addCommand">addCommand</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt><tt class="py-param">name</tt><tt class="py-op">,</tt><tt class="py-param">cmddisco</tt><tt class="py-op">,</tt><tt class="py-param">cmdexecute</tt><tt class="py-op">,</tt><tt class="py-param">jid</tt><tt class="py-op">=</tt><tt class="py-string">''</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="Commands.addCommand-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="Commands.addCommand-expanded"><a name="L131"></a><tt class="py-lineno">131</tt>  <tt class="py-line">        <tt class="py-docstring">"""The method to call if adding a new command to the session, the requred parameters of cmddisco and cmdexecute are the methods to enable that command to be executed"""</tt> </tt>
<a name="L132"></a><tt class="py-lineno">132</tt>  <tt class="py-line">        <tt class="py-comment"># This command takes a command object and the name of the command for registration</tt> </tt>
<a name="L133"></a><tt class="py-lineno">133</tt>  <tt class="py-line"><tt class="py-comment"></tt>        <tt class="py-comment"># We must:</tt> </tt>
<a name="L134"></a><tt class="py-lineno">134</tt>  <tt class="py-line"><tt class="py-comment"></tt>        <tt class="py-comment">#   Add item into disco</tt> </tt>
<a name="L135"></a><tt class="py-lineno">135</tt>  <tt class="py-line"><tt class="py-comment"></tt>        <tt class="py-comment">#   Add item into command list</tt> </tt>
<a name="L136"></a><tt class="py-lineno">136</tt>  <tt class="py-line"><tt class="py-comment"></tt>        <tt class="py-keyword">if</tt> <tt class="py-keyword">not</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_handlers</tt><tt class="py-op">.</tt><tt class="py-name">has_key</tt><tt class="py-op">(</tt><tt class="py-name">jid</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L137"></a><tt class="py-lineno">137</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_handlers</tt><tt class="py-op">[</tt><tt class="py-name">jid</tt><tt class="py-op">]</tt><tt class="py-op">=</tt><tt class="py-op">{</tt><tt class="py-op">}</tt> </tt>
<a name="L138"></a><tt class="py-lineno">138</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_browser</tt><tt class="py-op">.</tt><tt id="link-49" class="py-name"><a title="xmpp.browser.Browser.setDiscoHandler" class="py-name" href="#" onclick="return doclink('link-49', 'setDiscoHandler', 'link-12');">setDiscoHandler</a></tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-50" class="py-name"><a title="xmpp.commands.Command_Handler_Prototype._DiscoHandler
xmpp.commands.Commands._DiscoHandler" class="py-name" href="#" onclick="return doclink('link-50', '_DiscoHandler', 'link-13');">_DiscoHandler</a></tt><tt class="py-op">,</tt><tt class="py-name">node</tt><tt class="py-op">=</tt><tt id="link-51" class="py-name"><a title="xmpp.protocol.NS_COMMANDS" class="py-name" href="#" onclick="return doclink('link-51', 'NS_COMMANDS', 'link-8');">NS_COMMANDS</a></tt><tt class="py-op">,</tt><tt class="py-name">jid</tt><tt class="py-op">=</tt><tt class="py-name">jid</tt><tt class="py-op">)</tt> </tt>
<a name="L139"></a><tt class="py-lineno">139</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_handlers</tt><tt class="py-op">[</tt><tt class="py-name">jid</tt><tt class="py-op">]</tt><tt class="py-op">.</tt><tt class="py-name">has_key</tt><tt class="py-op">(</tt><tt id="link-52" class="py-name" targets="Variable xmpp.auth.name=xmpp.auth-module.html#name,Variable xmpp.browser.name=xmpp.browser-module.html#name,Variable xmpp.commands.Command_Handler_Prototype.name=xmpp.commands.Command_Handler_Prototype-class.html#name,Variable xmpp.commands.TestCommand.name=xmpp.commands.TestCommand-class.html#name,Variable xmpp.commands.name=xmpp.commands-module.html#name,Variable xmpp.dispatcher.name=xmpp.dispatcher-module.html#name,Variable xmpp.features.name=xmpp.features-module.html#name,Variable xmpp.filetransfer.name=xmpp.filetransfer-module.html#name,Variable xmpp.name=xmpp-module.html#name,Variable xmpp.protocol.name=xmpp.protocol-module.html#name,Variable xmpp.roster.name=xmpp.roster-module.html#name,Variable xmpp.session.name=xmpp.session-module.html#name,Variable xmpp.transports.name=xmpp.transports-module.html#name"><a title="xmpp.auth.name
xmpp.browser.name
xmpp.commands.Command_Handler_Prototype.name
xmpp.commands.TestCommand.name
xmpp.commands.name
xmpp.dispatcher.name
xmpp.features.name
xmpp.filetransfer.name
xmpp.name
xmpp.protocol.name
xmpp.roster.name
xmpp.session.name
xmpp.transports.name" class="py-name" href="#" onclick="return doclink('link-52', 'name', 'link-52');">name</a></tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L140"></a><tt class="py-lineno">140</tt>  <tt class="py-line">            <tt class="py-keyword">raise</tt> <tt class="py-name">NameError</tt><tt class="py-op">,</tt><tt class="py-string">'Command Exists'</tt> </tt>
<a name="L141"></a><tt class="py-lineno">141</tt>  <tt class="py-line">        <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
<a name="L142"></a><tt class="py-lineno">142</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_handlers</tt><tt class="py-op">[</tt><tt class="py-name">jid</tt><tt class="py-op">]</tt><tt class="py-op">[</tt><tt id="link-53" class="py-name"><a title="xmpp.auth.name
xmpp.browser.name
xmpp.commands.Command_Handler_Prototype.name
xmpp.commands.TestCommand.name
xmpp.commands.name
xmpp.dispatcher.name
xmpp.features.name
xmpp.filetransfer.name
xmpp.name
xmpp.protocol.name
xmpp.roster.name
xmpp.session.name
xmpp.transports.name" class="py-name" href="#" onclick="return doclink('link-53', 'name', 'link-52');">name</a></tt><tt class="py-op">]</tt><tt class="py-op">=</tt><tt class="py-op">{</tt><tt class="py-string">'disco'</tt><tt class="py-op">:</tt><tt class="py-name">cmddisco</tt><tt class="py-op">,</tt><tt class="py-string">'execute'</tt><tt class="py-op">:</tt><tt class="py-name">cmdexecute</tt><tt class="py-op">}</tt> </tt>
<a name="L143"></a><tt class="py-lineno">143</tt>  <tt class="py-line">        <tt class="py-comment"># Need to add disco stuff here</tt> </tt>
<a name="L144"></a><tt class="py-lineno">144</tt>  <tt class="py-line"><tt class="py-comment"></tt>        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_browser</tt><tt class="py-op">.</tt><tt id="link-54" class="py-name"><a title="xmpp.browser.Browser.setDiscoHandler" class="py-name" href="#" onclick="return doclink('link-54', 'setDiscoHandler', 'link-12');">setDiscoHandler</a></tt><tt class="py-op">(</tt><tt class="py-name">cmddisco</tt><tt class="py-op">,</tt><tt class="py-name">node</tt><tt class="py-op">=</tt><tt id="link-55" class="py-name"><a title="xmpp.auth.name
xmpp.browser.name
xmpp.commands.Command_Handler_Prototype.name
xmpp.commands.TestCommand.name
xmpp.commands.name
xmpp.dispatcher.name
xmpp.features.name
xmpp.filetransfer.name
xmpp.name
xmpp.protocol.name
xmpp.roster.name
xmpp.session.name
xmpp.transports.name" class="py-name" href="#" onclick="return doclink('link-55', 'name', 'link-52');">name</a></tt><tt class="py-op">,</tt><tt class="py-name">jid</tt><tt class="py-op">=</tt><tt class="py-name">jid</tt><tt class="py-op">)</tt> </tt>
</div><a name="L145"></a><tt class="py-lineno">145</tt>  <tt class="py-line"> </tt>
<a name="Commands.delCommand"></a><div id="Commands.delCommand-def"><a name="L146"></a><tt class="py-lineno">146</tt> <a class="py-toggle" href="#" id="Commands.delCommand-toggle" onclick="return toggle('Commands.delCommand');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="xmpp.commands.Commands-class.html#delCommand">delCommand</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt><tt class="py-param">name</tt><tt class="py-op">,</tt><tt class="py-param">jid</tt><tt class="py-op">=</tt><tt class="py-string">''</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="Commands.delCommand-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="Commands.delCommand-expanded"><a name="L147"></a><tt class="py-lineno">147</tt>  <tt class="py-line">        <tt class="py-docstring">"""Removed command from the session"""</tt> </tt>
<a name="L148"></a><tt class="py-lineno">148</tt>  <tt class="py-line">        <tt class="py-comment"># This command takes a command object and the name used for registration</tt> </tt>
<a name="L149"></a><tt class="py-lineno">149</tt>  <tt class="py-line"><tt class="py-comment"></tt>        <tt class="py-comment"># We must:</tt> </tt>
<a name="L150"></a><tt class="py-lineno">150</tt>  <tt class="py-line"><tt class="py-comment"></tt>        <tt class="py-comment">#   Remove item from disco</tt> </tt>
<a name="L151"></a><tt class="py-lineno">151</tt>  <tt class="py-line"><tt class="py-comment"></tt>        <tt class="py-comment">#   Remove item from command list</tt> </tt>
<a name="L152"></a><tt class="py-lineno">152</tt>  <tt class="py-line"><tt class="py-comment"></tt>        <tt class="py-keyword">if</tt> <tt class="py-keyword">not</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_handlers</tt><tt class="py-op">.</tt><tt class="py-name">has_key</tt><tt class="py-op">(</tt><tt class="py-name">jid</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L153"></a><tt class="py-lineno">153</tt>  <tt class="py-line">            <tt class="py-keyword">raise</tt> <tt class="py-name">NameError</tt><tt class="py-op">,</tt><tt class="py-string">'Jid not found'</tt> </tt>
<a name="L154"></a><tt class="py-lineno">154</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-keyword">not</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_handlers</tt><tt class="py-op">[</tt><tt class="py-name">jid</tt><tt class="py-op">]</tt><tt class="py-op">.</tt><tt class="py-name">has_key</tt><tt class="py-op">(</tt><tt id="link-56" class="py-name"><a title="xmpp.auth.name
xmpp.browser.name
xmpp.commands.Command_Handler_Prototype.name
xmpp.commands.TestCommand.name
xmpp.commands.name
xmpp.dispatcher.name
xmpp.features.name
xmpp.filetransfer.name
xmpp.name
xmpp.protocol.name
xmpp.roster.name
xmpp.session.name
xmpp.transports.name" class="py-name" href="#" onclick="return doclink('link-56', 'name', 'link-52');">name</a></tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L155"></a><tt class="py-lineno">155</tt>  <tt class="py-line">            <tt class="py-keyword">raise</tt> <tt class="py-name">NameError</tt><tt class="py-op">,</tt> <tt class="py-string">'Command not found'</tt> </tt>
<a name="L156"></a><tt class="py-lineno">156</tt>  <tt class="py-line">        <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
<a name="L157"></a><tt class="py-lineno">157</tt>  <tt class="py-line">            <tt class="py-comment">#Do disco removal here</tt> </tt>
<a name="L158"></a><tt class="py-lineno">158</tt>  <tt class="py-line"><tt class="py-comment"></tt>            <tt class="py-name">command</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-57" class="py-name" targets="Method xmpp.commands.Commands.getCommand()=xmpp.commands.Commands-class.html#getCommand"><a title="xmpp.commands.Commands.getCommand" class="py-name" href="#" onclick="return doclink('link-57', 'getCommand', 'link-57');">getCommand</a></tt><tt class="py-op">(</tt><tt id="link-58" class="py-name"><a title="xmpp.auth.name
xmpp.browser.name
xmpp.commands.Command_Handler_Prototype.name
xmpp.commands.TestCommand.name
xmpp.commands.name
xmpp.dispatcher.name
xmpp.features.name
xmpp.filetransfer.name
xmpp.name
xmpp.protocol.name
xmpp.roster.name
xmpp.session.name
xmpp.transports.name" class="py-name" href="#" onclick="return doclink('link-58', 'name', 'link-52');">name</a></tt><tt class="py-op">,</tt><tt class="py-name">jid</tt><tt class="py-op">)</tt><tt class="py-op">[</tt><tt class="py-string">'disco'</tt><tt class="py-op">]</tt> </tt>
<a name="L159"></a><tt class="py-lineno">159</tt>  <tt class="py-line">            <tt class="py-keyword">del</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_handlers</tt><tt class="py-op">[</tt><tt class="py-name">jid</tt><tt class="py-op">]</tt><tt class="py-op">[</tt><tt id="link-59" class="py-name"><a title="xmpp.auth.name
xmpp.browser.name
xmpp.commands.Command_Handler_Prototype.name
xmpp.commands.TestCommand.name
xmpp.commands.name
xmpp.dispatcher.name
xmpp.features.name
xmpp.filetransfer.name
xmpp.name
xmpp.protocol.name
xmpp.roster.name
xmpp.session.name
xmpp.transports.name" class="py-name" href="#" onclick="return doclink('link-59', 'name', 'link-52');">name</a></tt><tt class="py-op">]</tt> </tt>
<a name="L160"></a><tt class="py-lineno">160</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_browser</tt><tt class="py-op">.</tt><tt id="link-60" class="py-name"><a title="xmpp.browser.Browser.delDiscoHandler" class="py-name" href="#" onclick="return doclink('link-60', 'delDiscoHandler', 'link-18');">delDiscoHandler</a></tt><tt class="py-op">(</tt><tt class="py-name">command</tt><tt class="py-op">,</tt><tt class="py-name">node</tt><tt class="py-op">=</tt><tt id="link-61" class="py-name"><a title="xmpp.auth.name
xmpp.browser.name
xmpp.commands.Command_Handler_Prototype.name
xmpp.commands.TestCommand.name
xmpp.commands.name
xmpp.dispatcher.name
xmpp.features.name
xmpp.filetransfer.name
xmpp.name
xmpp.protocol.name
xmpp.roster.name
xmpp.session.name
xmpp.transports.name" class="py-name" href="#" onclick="return doclink('link-61', 'name', 'link-52');">name</a></tt><tt class="py-op">,</tt><tt class="py-name">jid</tt><tt class="py-op">=</tt><tt class="py-name">jid</tt><tt class="py-op">)</tt> </tt>
</div><a name="L161"></a><tt class="py-lineno">161</tt>  <tt class="py-line"> </tt>
<a name="Commands.getCommand"></a><div id="Commands.getCommand-def"><a name="L162"></a><tt class="py-lineno">162</tt> <a class="py-toggle" href="#" id="Commands.getCommand-toggle" onclick="return toggle('Commands.getCommand');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="xmpp.commands.Commands-class.html#getCommand">getCommand</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt><tt class="py-param">name</tt><tt class="py-op">,</tt><tt class="py-param">jid</tt><tt class="py-op">=</tt><tt class="py-string">''</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="Commands.getCommand-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="Commands.getCommand-expanded"><a name="L163"></a><tt class="py-lineno">163</tt>  <tt class="py-line">        <tt class="py-docstring">"""Returns the command tuple"""</tt> </tt>
<a name="L164"></a><tt class="py-lineno">164</tt>  <tt class="py-line">        <tt class="py-comment"># This gets the command object with name</tt> </tt>
<a name="L165"></a><tt class="py-lineno">165</tt>  <tt class="py-line"><tt class="py-comment"></tt>        <tt class="py-comment"># We must:</tt> </tt>
<a name="L166"></a><tt class="py-lineno">166</tt>  <tt class="py-line"><tt class="py-comment"></tt>        <tt class="py-comment">#   Return item that matches this name</tt> </tt>
<a name="L167"></a><tt class="py-lineno">167</tt>  <tt class="py-line"><tt class="py-comment"></tt>        <tt class="py-keyword">if</tt> <tt class="py-keyword">not</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_handlers</tt><tt class="py-op">.</tt><tt class="py-name">has_key</tt><tt class="py-op">(</tt><tt class="py-name">jid</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L168"></a><tt class="py-lineno">168</tt>  <tt class="py-line">            <tt class="py-keyword">raise</tt> <tt class="py-name">NameError</tt><tt class="py-op">,</tt><tt class="py-string">'Jid not found'</tt> </tt>
<a name="L169"></a><tt class="py-lineno">169</tt>  <tt class="py-line">        <tt class="py-keyword">elif</tt> <tt class="py-keyword">not</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_handlers</tt><tt class="py-op">[</tt><tt class="py-name">jid</tt><tt class="py-op">]</tt><tt class="py-op">.</tt><tt class="py-name">has_key</tt><tt class="py-op">(</tt><tt id="link-62" class="py-name"><a title="xmpp.auth.name
xmpp.browser.name
xmpp.commands.Command_Handler_Prototype.name
xmpp.commands.TestCommand.name
xmpp.commands.name
xmpp.dispatcher.name
xmpp.features.name
xmpp.filetransfer.name
xmpp.name
xmpp.protocol.name
xmpp.roster.name
xmpp.session.name
xmpp.transports.name" class="py-name" href="#" onclick="return doclink('link-62', 'name', 'link-52');">name</a></tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L170"></a><tt class="py-lineno">170</tt>  <tt class="py-line">            <tt class="py-keyword">raise</tt> <tt class="py-name">NameError</tt><tt class="py-op">,</tt><tt class="py-string">'Command not found'</tt> </tt>
<a name="L171"></a><tt class="py-lineno">171</tt>  <tt class="py-line">        <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
<a name="L172"></a><tt class="py-lineno">172</tt>  <tt class="py-line">            <tt class="py-keyword">return</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_handlers</tt><tt class="py-op">[</tt><tt class="py-name">jid</tt><tt class="py-op">]</tt><tt class="py-op">[</tt><tt id="link-63" class="py-name"><a title="xmpp.auth.name
xmpp.browser.name
xmpp.commands.Command_Handler_Prototype.name
xmpp.commands.TestCommand.name
xmpp.commands.name
xmpp.dispatcher.name
xmpp.features.name
xmpp.filetransfer.name
xmpp.name
xmpp.protocol.name
xmpp.roster.name
xmpp.session.name
xmpp.transports.name" class="py-name" href="#" onclick="return doclink('link-63', 'name', 'link-52');">name</a></tt><tt class="py-op">]</tt> </tt>
</div></div><a name="L173"></a><tt class="py-lineno">173</tt>  <tt class="py-line"> </tt>
<a name="Command_Handler_Prototype"></a><div id="Command_Handler_Prototype-def"><a name="L174"></a><tt class="py-lineno">174</tt> <a class="py-toggle" href="#" id="Command_Handler_Prototype-toggle" onclick="return toggle('Command_Handler_Prototype');">-</a><tt class="py-line"><tt class="py-keyword">class</tt> <a class="py-def-name" href="xmpp.commands.Command_Handler_Prototype-class.html">Command_Handler_Prototype</a><tt class="py-op">(</tt><tt class="py-base-class">PlugIn</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="Command_Handler_Prototype-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="Command_Handler_Prototype-expanded"><a name="L175"></a><tt class="py-lineno">175</tt>  <tt class="py-line">    <tt class="py-docstring">"""This is a prototype command handler, as each command uses a disco method </tt> </tt>
<a name="L176"></a><tt class="py-lineno">176</tt>  <tt class="py-line"><tt class="py-docstring">       and execute method you can implement it any way you like, however this is </tt> </tt>
<a name="L177"></a><tt class="py-lineno">177</tt>  <tt class="py-line"><tt class="py-docstring">       my first attempt at making a generic handler that you can hang process </tt> </tt>
<a name="L178"></a><tt class="py-lineno">178</tt>  <tt class="py-line"><tt class="py-docstring">       stages on too. There is an example command below.</tt> </tt>
<a name="L179"></a><tt class="py-lineno">179</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L180"></a><tt class="py-lineno">180</tt>  <tt class="py-line"><tt class="py-docstring">    The parameters are as follows:</tt> </tt>
<a name="L181"></a><tt class="py-lineno">181</tt>  <tt class="py-line"><tt class="py-docstring">    name : the name of the command within the jabber environment</tt> </tt>
<a name="L182"></a><tt class="py-lineno">182</tt>  <tt class="py-line"><tt class="py-docstring">    description : the natural language description</tt> </tt>
<a name="L183"></a><tt class="py-lineno">183</tt>  <tt class="py-line"><tt class="py-docstring">    discofeatures : the features supported by the command</tt> </tt>
<a name="L184"></a><tt class="py-lineno">184</tt>  <tt class="py-line"><tt class="py-docstring">    initial : the initial command in the from of {'execute':commandname}</tt> </tt>
<a name="L185"></a><tt class="py-lineno">185</tt>  <tt class="py-line"><tt class="py-docstring">    </tt> </tt>
<a name="L186"></a><tt class="py-lineno">186</tt>  <tt class="py-line"><tt class="py-docstring">    All stages set the 'actions' dictionary for each session to represent the possible options available.</tt> </tt>
<a name="L187"></a><tt class="py-lineno">187</tt>  <tt class="py-line"><tt class="py-docstring">    """</tt> </tt>
<a name="L188"></a><tt class="py-lineno">188</tt>  <tt class="py-line">    <tt id="link-64" class="py-name"><a title="xmpp.auth.name
xmpp.browser.name
xmpp.commands.Command_Handler_Prototype.name
xmpp.commands.TestCommand.name
xmpp.commands.name
xmpp.dispatcher.name
xmpp.features.name
xmpp.filetransfer.name
xmpp.name
xmpp.protocol.name
xmpp.roster.name
xmpp.session.name
xmpp.transports.name" class="py-name" href="#" onclick="return doclink('link-64', 'name', 'link-52');">name</a></tt> <tt class="py-op">=</tt> <tt class="py-string">'examplecommand'</tt> </tt>
<a name="L189"></a><tt class="py-lineno">189</tt>  <tt class="py-line">    <tt id="link-65" class="py-name" targets="Variable xmpp.commands.Command_Handler_Prototype.count=xmpp.commands.Command_Handler_Prototype-class.html#count"><a title="xmpp.commands.Command_Handler_Prototype.count" class="py-name" href="#" onclick="return doclink('link-65', 'count', 'link-65');">count</a></tt> <tt class="py-op">=</tt> <tt class="py-number">0</tt> </tt>
<a name="L190"></a><tt class="py-lineno">190</tt>  <tt class="py-line">    <tt id="link-66" class="py-name" targets="Variable xmpp.commands.Command_Handler_Prototype.description=xmpp.commands.Command_Handler_Prototype-class.html#description,Variable xmpp.commands.TestCommand.description=xmpp.commands.TestCommand-class.html#description"><a title="xmpp.commands.Command_Handler_Prototype.description
xmpp.commands.TestCommand.description" class="py-name" href="#" onclick="return doclink('link-66', 'description', 'link-66');">description</a></tt> <tt class="py-op">=</tt> <tt class="py-string">'an example command'</tt> </tt>
<a name="L191"></a><tt class="py-lineno">191</tt>  <tt class="py-line">    <tt id="link-67" class="py-name" targets="Variable xmpp.commands.Command_Handler_Prototype.discofeatures=xmpp.commands.Command_Handler_Prototype-class.html#discofeatures"><a title="xmpp.commands.Command_Handler_Prototype.discofeatures" class="py-name" href="#" onclick="return doclink('link-67', 'discofeatures', 'link-67');">discofeatures</a></tt> <tt class="py-op">=</tt> <tt class="py-op">[</tt><tt id="link-68" class="py-name"><a title="xmpp.protocol.NS_COMMANDS" class="py-name" href="#" onclick="return doclink('link-68', 'NS_COMMANDS', 'link-8');">NS_COMMANDS</a></tt><tt class="py-op">,</tt><tt id="link-69" class="py-name" targets="Variable xmpp.protocol.NS_DATA=xmpp.protocol-module.html#NS_DATA"><a title="xmpp.protocol.NS_DATA" class="py-name" href="#" onclick="return doclink('link-69', 'NS_DATA', 'link-69');">NS_DATA</a></tt><tt class="py-op">]</tt> </tt>
<a name="L192"></a><tt class="py-lineno">192</tt>  <tt class="py-line">    <tt class="py-comment"># This is the command template</tt> </tt>
<a name="Command_Handler_Prototype.__init__"></a><div id="Command_Handler_Prototype.__init__-def"><a name="L193"></a><tt class="py-lineno">193</tt> <a class="py-toggle" href="#" id="Command_Handler_Prototype.__init__-toggle" onclick="return toggle('Command_Handler_Prototype.__init__');">-</a><tt class="py-line"><tt class="py-comment"></tt>    <tt class="py-keyword">def</tt> <a class="py-def-name" href="xmpp.commands.Command_Handler_Prototype-class.html#__init__">__init__</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt><tt class="py-param">jid</tt><tt class="py-op">=</tt><tt class="py-string">''</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="Command_Handler_Prototype.__init__-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="Command_Handler_Prototype.__init__-expanded"><a name="L194"></a><tt class="py-lineno">194</tt>  <tt class="py-line">        <tt class="py-docstring">"""Set up the class"""</tt> </tt>
<a name="L195"></a><tt class="py-lineno">195</tt>  <tt class="py-line">        <tt id="link-70" class="py-name"><a title="xmpp.client.PlugIn
xmpp.client.PlugIn.PlugIn
xmpp.transports.TLS.PlugIn" class="py-name" href="#" onclick="return doclink('link-70', 'PlugIn', 'link-2');">PlugIn</a></tt><tt class="py-op">.</tt><tt id="link-71" class="py-name"><a title="xmpp.auth.Bind.__init__
xmpp.auth.ComponentBind.__init__
xmpp.auth.NonSASL.__init__
xmpp.auth.SASL.__init__
xmpp.browser.Browser.__init__
xmpp.client.CommonClient.__init__
xmpp.client.Component.__init__
xmpp.client.PlugIn.__init__
xmpp.commands.Command_Handler_Prototype.__init__
xmpp.commands.Commands.__init__
xmpp.commands.TestCommand.__init__
xmpp.debug.Debug.__init__
xmpp.debug.NoDebug.__init__
xmpp.dispatcher.Dispatcher.__init__
xmpp.filetransfer.IBB.__init__
xmpp.protocol.DataField.__init__
xmpp.protocol.DataForm.__init__
xmpp.protocol.Error.__init__
xmpp.protocol.ErrorNode.__init__
xmpp.protocol.Iq.__init__
xmpp.protocol.JID.__init__
xmpp.protocol.Message.__init__
xmpp.protocol.Presence.__init__
xmpp.protocol.Protocol.__init__
xmpp.roster.Roster.__init__
xmpp.session.Session.__init__
xmpp.simplexml.Node.__init__
xmpp.simplexml.NodeBuilder.__init__
xmpp.simplexml.T.__init__
xmpp.transports.HTTPPROXYsocket.__init__
xmpp.transports.TCPsocket.__init__
xmpp.transports.error.__init__" class="py-name" href="#" onclick="return doclink('link-71', '__init__', 'link-4');">__init__</a></tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">)</tt> </tt>
<a name="L196"></a><tt class="py-lineno">196</tt>  <tt class="py-line">        <tt class="py-name">DBG_LINE</tt><tt class="py-op">=</tt><tt class="py-string">'command'</tt> </tt>
<a name="L197"></a><tt class="py-lineno">197</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">sessioncount</tt> <tt class="py-op">=</tt> <tt class="py-number">0</tt> </tt>
<a name="L198"></a><tt class="py-lineno">198</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">sessions</tt> <tt class="py-op">=</tt> <tt class="py-op">{</tt><tt class="py-op">}</tt> </tt>
<a name="L199"></a><tt class="py-lineno">199</tt>  <tt class="py-line">        <tt class="py-comment"># Disco information for command list pre-formatted as a tuple</tt> </tt>
<a name="L200"></a><tt class="py-lineno">200</tt>  <tt class="py-line"><tt class="py-comment"></tt>        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">discoinfo</tt> <tt class="py-op">=</tt> <tt class="py-op">{</tt><tt class="py-string">'ids'</tt><tt class="py-op">:</tt><tt class="py-op">[</tt><tt class="py-op">{</tt><tt class="py-string">'category'</tt><tt class="py-op">:</tt><tt class="py-string">'automation'</tt><tt class="py-op">,</tt><tt class="py-string">'type'</tt><tt class="py-op">:</tt><tt class="py-string">'command-node'</tt><tt class="py-op">,</tt><tt class="py-string">'name'</tt><tt class="py-op">:</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-72" class="py-name"><a title="xmpp.commands.Command_Handler_Prototype.description
xmpp.commands.TestCommand.description" class="py-name" href="#" onclick="return doclink('link-72', 'description', 'link-66');">description</a></tt><tt class="py-op">}</tt><tt class="py-op">]</tt><tt class="py-op">,</tt><tt class="py-string">'features'</tt><tt class="py-op">:</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-73" class="py-name"><a title="xmpp.commands.Command_Handler_Prototype.discofeatures" class="py-name" href="#" onclick="return doclink('link-73', 'discofeatures', 'link-67');">discofeatures</a></tt><tt class="py-op">}</tt> </tt>
<a name="L201"></a><tt class="py-lineno">201</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_jid</tt> <tt class="py-op">=</tt> <tt class="py-name">jid</tt> </tt>
</div><a name="L202"></a><tt class="py-lineno">202</tt>  <tt class="py-line"> </tt>
<a name="Command_Handler_Prototype.plugin"></a><div id="Command_Handler_Prototype.plugin-def"><a name="L203"></a><tt class="py-lineno">203</tt> <a class="py-toggle" href="#" id="Command_Handler_Prototype.plugin-toggle" onclick="return toggle('Command_Handler_Prototype.plugin');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="xmpp.commands.Command_Handler_Prototype-class.html#plugin">plugin</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt><tt class="py-param">owner</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="Command_Handler_Prototype.plugin-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="Command_Handler_Prototype.plugin-expanded"><a name="L204"></a><tt class="py-lineno">204</tt>  <tt class="py-line">        <tt class="py-docstring">"""Plug command into the commands class"""</tt> </tt>
<a name="L205"></a><tt class="py-lineno">205</tt>  <tt class="py-line">        <tt class="py-comment"># The owner in this instance is the Command Processor</tt> </tt>
<a name="L206"></a><tt class="py-lineno">206</tt>  <tt class="py-line"><tt class="py-comment"></tt>        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_commands</tt> <tt class="py-op">=</tt> <tt class="py-name">owner</tt> </tt>
<a name="L207"></a><tt class="py-lineno">207</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_owner</tt> <tt class="py-op">=</tt> <tt class="py-name">owner</tt><tt class="py-op">.</tt><tt class="py-name">_owner</tt> </tt>
<a name="L208"></a><tt class="py-lineno">208</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_commands</tt><tt class="py-op">.</tt><tt id="link-74" class="py-name" targets="Method xmpp.commands.Commands.addCommand()=xmpp.commands.Commands-class.html#addCommand"><a title="xmpp.commands.Commands.addCommand" class="py-name" href="#" onclick="return doclink('link-74', 'addCommand', 'link-74');">addCommand</a></tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-75" class="py-name"><a title="xmpp.auth.name
xmpp.browser.name
xmpp.commands.Command_Handler_Prototype.name
xmpp.commands.TestCommand.name
xmpp.commands.name
xmpp.dispatcher.name
xmpp.features.name
xmpp.filetransfer.name
xmpp.name
xmpp.protocol.name
xmpp.roster.name
xmpp.session.name
xmpp.transports.name" class="py-name" href="#" onclick="return doclink('link-75', 'name', 'link-52');">name</a></tt><tt class="py-op">,</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-76" class="py-name"><a title="xmpp.commands.Command_Handler_Prototype._DiscoHandler
xmpp.commands.Commands._DiscoHandler" class="py-name" href="#" onclick="return doclink('link-76', '_DiscoHandler', 'link-13');">_DiscoHandler</a></tt><tt class="py-op">,</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-77" class="py-name" targets="Method xmpp.commands.Command_Handler_Prototype.Execute()=xmpp.commands.Command_Handler_Prototype-class.html#Execute"><a title="xmpp.commands.Command_Handler_Prototype.Execute" class="py-name" href="#" onclick="return doclink('link-77', 'Execute', 'link-77');">Execute</a></tt><tt class="py-op">,</tt><tt class="py-name">jid</tt><tt class="py-op">=</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_jid</tt><tt class="py-op">)</tt> </tt>
</div><a name="L209"></a><tt class="py-lineno">209</tt>  <tt class="py-line"> </tt>
<a name="Command_Handler_Prototype.plugout"></a><div id="Command_Handler_Prototype.plugout-def"><a name="L210"></a><tt class="py-lineno">210</tt> <a class="py-toggle" href="#" id="Command_Handler_Prototype.plugout-toggle" onclick="return toggle('Command_Handler_Prototype.plugout');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="xmpp.commands.Command_Handler_Prototype-class.html#plugout">plugout</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="Command_Handler_Prototype.plugout-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="Command_Handler_Prototype.plugout-expanded"><a name="L211"></a><tt class="py-lineno">211</tt>  <tt class="py-line">        <tt class="py-docstring">"""Remove command from the commands class"""</tt> </tt>
<a name="L212"></a><tt class="py-lineno">212</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_commands</tt><tt class="py-op">.</tt><tt id="link-78" class="py-name" targets="Method xmpp.commands.Commands.delCommand()=xmpp.commands.Commands-class.html#delCommand"><a title="xmpp.commands.Commands.delCommand" class="py-name" href="#" onclick="return doclink('link-78', 'delCommand', 'link-78');">delCommand</a></tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-79" class="py-name"><a title="xmpp.auth.name
xmpp.browser.name
xmpp.commands.Command_Handler_Prototype.name
xmpp.commands.TestCommand.name
xmpp.commands.name
xmpp.dispatcher.name
xmpp.features.name
xmpp.filetransfer.name
xmpp.name
xmpp.protocol.name
xmpp.roster.name
xmpp.session.name
xmpp.transports.name" class="py-name" href="#" onclick="return doclink('link-79', 'name', 'link-52');">name</a></tt><tt class="py-op">,</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_jid</tt><tt class="py-op">)</tt> </tt>
</div><a name="L213"></a><tt class="py-lineno">213</tt>  <tt class="py-line"> </tt>
<a name="Command_Handler_Prototype.getSessionID"></a><div id="Command_Handler_Prototype.getSessionID-def"><a name="L214"></a><tt class="py-lineno">214</tt> <a class="py-toggle" href="#" id="Command_Handler_Prototype.getSessionID-toggle" onclick="return toggle('Command_Handler_Prototype.getSessionID');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="xmpp.commands.Command_Handler_Prototype-class.html#getSessionID">getSessionID</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="Command_Handler_Prototype.getSessionID-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="Command_Handler_Prototype.getSessionID-expanded"><a name="L215"></a><tt class="py-lineno">215</tt>  <tt class="py-line">        <tt class="py-docstring">"""Returns an id for the command session"""</tt> </tt>
<a name="L216"></a><tt class="py-lineno">216</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-80" class="py-name"><a title="xmpp.commands.Command_Handler_Prototype.count" class="py-name" href="#" onclick="return doclink('link-80', 'count', 'link-65');">count</a></tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-81" class="py-name"><a title="xmpp.commands.Command_Handler_Prototype.count" class="py-name" href="#" onclick="return doclink('link-81', 'count', 'link-65');">count</a></tt><tt class="py-op">+</tt><tt class="py-number">1</tt> </tt>
<a name="L217"></a><tt class="py-lineno">217</tt>  <tt class="py-line">        <tt class="py-keyword">return</tt> <tt class="py-string">'cmd-%s-%d'</tt><tt class="py-op">%</tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-82" class="py-name"><a title="xmpp.auth.name
xmpp.browser.name
xmpp.commands.Command_Handler_Prototype.name
xmpp.commands.TestCommand.name
xmpp.commands.name
xmpp.dispatcher.name
xmpp.features.name
xmpp.filetransfer.name
xmpp.name
xmpp.protocol.name
xmpp.roster.name
xmpp.session.name
xmpp.transports.name" class="py-name" href="#" onclick="return doclink('link-82', 'name', 'link-52');">name</a></tt><tt class="py-op">,</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-83" class="py-name"><a title="xmpp.commands.Command_Handler_Prototype.count" class="py-name" href="#" onclick="return doclink('link-83', 'count', 'link-65');">count</a></tt><tt class="py-op">)</tt> </tt>
</div><a name="L218"></a><tt class="py-lineno">218</tt>  <tt class="py-line"> </tt>
<a name="Command_Handler_Prototype.Execute"></a><div id="Command_Handler_Prototype.Execute-def"><a name="L219"></a><tt class="py-lineno">219</tt> <a class="py-toggle" href="#" id="Command_Handler_Prototype.Execute-toggle" onclick="return toggle('Command_Handler_Prototype.Execute');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="xmpp.commands.Command_Handler_Prototype-class.html#Execute">Execute</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt><tt class="py-param">conn</tt><tt class="py-op">,</tt><tt class="py-param">request</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="Command_Handler_Prototype.Execute-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="Command_Handler_Prototype.Execute-expanded"><a name="L220"></a><tt class="py-lineno">220</tt>  <tt class="py-line">        <tt class="py-docstring">"""The method that handles all the commands, and routes them to the correct method for that stage."""</tt> </tt>
<a name="L221"></a><tt class="py-lineno">221</tt>  <tt class="py-line">        <tt class="py-comment"># New request or old?</tt> </tt>
<a name="L222"></a><tt class="py-lineno">222</tt>  <tt class="py-line"><tt class="py-comment"></tt>        <tt class="py-keyword">try</tt><tt class="py-op">:</tt> </tt>
<a name="L223"></a><tt class="py-lineno">223</tt>  <tt class="py-line">            <tt id="link-84" class="py-name" targets="Module xmpp.session=xmpp.session-module.html"><a title="xmpp.session" class="py-name" href="#" onclick="return doclink('link-84', 'session', 'link-84');">session</a></tt> <tt class="py-op">=</tt> <tt class="py-name">request</tt><tt class="py-op">.</tt><tt id="link-85" class="py-name"><a title="xmpp.simplexml.Node.getTagAttr" class="py-name" href="#" onclick="return doclink('link-85', 'getTagAttr', 'link-22');">getTagAttr</a></tt><tt class="py-op">(</tt><tt class="py-string">'command'</tt><tt class="py-op">,</tt><tt class="py-string">'sessionid'</tt><tt class="py-op">)</tt> </tt>
<a name="L224"></a><tt class="py-lineno">224</tt>  <tt class="py-line">        <tt class="py-keyword">except</tt><tt class="py-op">:</tt> </tt>
<a name="L225"></a><tt class="py-lineno">225</tt>  <tt class="py-line">            <tt id="link-86" class="py-name"><a title="xmpp.session" class="py-name" href="#" onclick="return doclink('link-86', 'session', 'link-84');">session</a></tt> <tt class="py-op">=</tt> <tt class="py-name">None</tt> </tt>
<a name="L226"></a><tt class="py-lineno">226</tt>  <tt class="py-line">        <tt class="py-keyword">try</tt><tt class="py-op">:</tt> </tt>
<a name="L227"></a><tt class="py-lineno">227</tt>  <tt class="py-line">            <tt class="py-name">action</tt> <tt class="py-op">=</tt> <tt class="py-name">request</tt><tt class="py-op">.</tt><tt id="link-87" class="py-name"><a title="xmpp.simplexml.Node.getTagAttr" class="py-name" href="#" onclick="return doclink('link-87', 'getTagAttr', 'link-22');">getTagAttr</a></tt><tt class="py-op">(</tt><tt class="py-string">'command'</tt><tt class="py-op">,</tt><tt class="py-string">'action'</tt><tt class="py-op">)</tt> </tt>
<a name="L228"></a><tt class="py-lineno">228</tt>  <tt class="py-line">        <tt class="py-keyword">except</tt><tt class="py-op">:</tt> </tt>
<a name="L229"></a><tt class="py-lineno">229</tt>  <tt class="py-line">            <tt class="py-name">action</tt> <tt class="py-op">=</tt> <tt class="py-name">None</tt> </tt>
<a name="L230"></a><tt class="py-lineno">230</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">action</tt> <tt class="py-op">==</tt> <tt class="py-name">None</tt><tt class="py-op">:</tt> <tt class="py-name">action</tt> <tt class="py-op">=</tt> <tt class="py-string">'execute'</tt> </tt>
<a name="L231"></a><tt class="py-lineno">231</tt>  <tt class="py-line">        <tt class="py-comment"># Check session is in session list</tt> </tt>
<a name="L232"></a><tt class="py-lineno">232</tt>  <tt class="py-line"><tt class="py-comment"></tt>        <tt class="py-keyword">if</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">sessions</tt><tt class="py-op">.</tt><tt class="py-name">has_key</tt><tt class="py-op">(</tt><tt id="link-88" class="py-name"><a title="xmpp.session" class="py-name" href="#" onclick="return doclink('link-88', 'session', 'link-84');">session</a></tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L233"></a><tt class="py-lineno">233</tt>  <tt class="py-line">            <tt class="py-keyword">if</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">sessions</tt><tt class="py-op">[</tt><tt id="link-89" class="py-name"><a title="xmpp.session" class="py-name" href="#" onclick="return doclink('link-89', 'session', 'link-84');">session</a></tt><tt class="py-op">]</tt><tt class="py-op">[</tt><tt class="py-string">'jid'</tt><tt class="py-op">]</tt><tt class="py-op">==</tt><tt class="py-name">request</tt><tt class="py-op">.</tt><tt id="link-90" class="py-name" targets="Method xmpp.protocol.Protocol.getFrom()=xmpp.protocol.Protocol-class.html#getFrom"><a title="xmpp.protocol.Protocol.getFrom" class="py-name" href="#" onclick="return doclink('link-90', 'getFrom', 'link-90');">getFrom</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L234"></a><tt class="py-lineno">234</tt>  <tt class="py-line">                <tt class="py-comment"># Check action is vaild</tt> </tt>
<a name="L235"></a><tt class="py-lineno">235</tt>  <tt class="py-line"><tt class="py-comment"></tt>                <tt class="py-keyword">if</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">sessions</tt><tt class="py-op">[</tt><tt id="link-91" class="py-name"><a title="xmpp.session" class="py-name" href="#" onclick="return doclink('link-91', 'session', 'link-84');">session</a></tt><tt class="py-op">]</tt><tt class="py-op">[</tt><tt class="py-string">'actions'</tt><tt class="py-op">]</tt><tt class="py-op">.</tt><tt class="py-name">has_key</tt><tt class="py-op">(</tt><tt class="py-name">action</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L236"></a><tt class="py-lineno">236</tt>  <tt class="py-line">                    <tt class="py-comment"># Execute next action</tt> </tt>
<a name="L237"></a><tt class="py-lineno">237</tt>  <tt class="py-line"><tt class="py-comment"></tt>                    <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">sessions</tt><tt class="py-op">[</tt><tt id="link-92" class="py-name"><a title="xmpp.session" class="py-name" href="#" onclick="return doclink('link-92', 'session', 'link-84');">session</a></tt><tt class="py-op">]</tt><tt class="py-op">[</tt><tt class="py-string">'actions'</tt><tt class="py-op">]</tt><tt class="py-op">[</tt><tt class="py-name">action</tt><tt class="py-op">]</tt><tt class="py-op">(</tt><tt class="py-name">conn</tt><tt class="py-op">,</tt><tt class="py-name">request</tt><tt class="py-op">)</tt> </tt>
<a name="L238"></a><tt class="py-lineno">238</tt>  <tt class="py-line">                <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
<a name="L239"></a><tt class="py-lineno">239</tt>  <tt class="py-line">                    <tt class="py-comment"># Stage not presented as an option</tt> </tt>
<a name="L240"></a><tt class="py-lineno">240</tt>  <tt class="py-line"><tt class="py-comment"></tt>                    <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_owner</tt><tt class="py-op">.</tt><tt id="link-93" class="py-name"><a title="xmpp.dispatcher.Dispatcher.send
xmpp.transports.TCPsocket.send" class="py-name" href="#" onclick="return doclink('link-93', 'send', 'link-23');">send</a></tt><tt class="py-op">(</tt><tt id="link-94" class="py-name"><a title="xmpp.protocol.Error" class="py-name" href="#" onclick="return doclink('link-94', 'Error', 'link-24');">Error</a></tt><tt class="py-op">(</tt><tt class="py-name">request</tt><tt class="py-op">,</tt><tt id="link-95" class="py-name"><a title="xmpp.ERR_BAD_REQUEST
xmpp.auth.ERR_BAD_REQUEST
xmpp.browser.ERR_BAD_REQUEST
xmpp.commands.ERR_BAD_REQUEST
xmpp.dispatcher.ERR_BAD_REQUEST
xmpp.features.ERR_BAD_REQUEST
xmpp.filetransfer.ERR_BAD_REQUEST
xmpp.protocol.ERR_BAD_REQUEST
xmpp.roster.ERR_BAD_REQUEST
xmpp.session.ERR_BAD_REQUEST
xmpp.transports.ERR_BAD_REQUEST" class="py-name" href="#" onclick="return doclink('link-95', 'ERR_BAD_REQUEST', 'link-25');">ERR_BAD_REQUEST</a></tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L241"></a><tt class="py-lineno">241</tt>  <tt class="py-line">                    <tt class="py-keyword">raise</tt> <tt id="link-96" class="py-name"><a title="xmpp.protocol.NodeProcessed" class="py-name" href="#" onclick="return doclink('link-96', 'NodeProcessed', 'link-26');">NodeProcessed</a></tt> </tt>
<a name="L242"></a><tt class="py-lineno">242</tt>  <tt class="py-line">            <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
<a name="L243"></a><tt class="py-lineno">243</tt>  <tt class="py-line">                <tt class="py-comment"># Jid and session don't match. Go away imposter</tt> </tt>
<a name="L244"></a><tt class="py-lineno">244</tt>  <tt class="py-line"><tt class="py-comment"></tt>                <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_owner</tt><tt class="py-op">.</tt><tt id="link-97" class="py-name"><a title="xmpp.dispatcher.Dispatcher.send
xmpp.transports.TCPsocket.send" class="py-name" href="#" onclick="return doclink('link-97', 'send', 'link-23');">send</a></tt><tt class="py-op">(</tt><tt id="link-98" class="py-name"><a title="xmpp.protocol.Error" class="py-name" href="#" onclick="return doclink('link-98', 'Error', 'link-24');">Error</a></tt><tt class="py-op">(</tt><tt class="py-name">request</tt><tt class="py-op">,</tt><tt id="link-99" class="py-name"><a title="xmpp.ERR_BAD_REQUEST
xmpp.auth.ERR_BAD_REQUEST
xmpp.browser.ERR_BAD_REQUEST
xmpp.commands.ERR_BAD_REQUEST
xmpp.dispatcher.ERR_BAD_REQUEST
xmpp.features.ERR_BAD_REQUEST
xmpp.filetransfer.ERR_BAD_REQUEST
xmpp.protocol.ERR_BAD_REQUEST
xmpp.roster.ERR_BAD_REQUEST
xmpp.session.ERR_BAD_REQUEST
xmpp.transports.ERR_BAD_REQUEST" class="py-name" href="#" onclick="return doclink('link-99', 'ERR_BAD_REQUEST', 'link-25');">ERR_BAD_REQUEST</a></tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L245"></a><tt class="py-lineno">245</tt>  <tt class="py-line">                <tt class="py-keyword">raise</tt> <tt id="link-100" class="py-name"><a title="xmpp.protocol.NodeProcessed" class="py-name" href="#" onclick="return doclink('link-100', 'NodeProcessed', 'link-26');">NodeProcessed</a></tt> </tt>
<a name="L246"></a><tt class="py-lineno">246</tt>  <tt class="py-line">        <tt class="py-keyword">elif</tt> <tt id="link-101" class="py-name"><a title="xmpp.session" class="py-name" href="#" onclick="return doclink('link-101', 'session', 'link-84');">session</a></tt> <tt class="py-op">!=</tt> <tt class="py-name">None</tt><tt class="py-op">:</tt> </tt>
<a name="L247"></a><tt class="py-lineno">247</tt>  <tt class="py-line">            <tt class="py-comment"># Not on this sessionid you won't.</tt> </tt>
<a name="L248"></a><tt class="py-lineno">248</tt>  <tt class="py-line"><tt class="py-comment"></tt>            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_owner</tt><tt class="py-op">.</tt><tt id="link-102" class="py-name"><a title="xmpp.dispatcher.Dispatcher.send
xmpp.transports.TCPsocket.send" class="py-name" href="#" onclick="return doclink('link-102', 'send', 'link-23');">send</a></tt><tt class="py-op">(</tt><tt id="link-103" class="py-name"><a title="xmpp.protocol.Error" class="py-name" href="#" onclick="return doclink('link-103', 'Error', 'link-24');">Error</a></tt><tt class="py-op">(</tt><tt class="py-name">request</tt><tt class="py-op">,</tt><tt id="link-104" class="py-name"><a title="xmpp.ERR_BAD_REQUEST
xmpp.auth.ERR_BAD_REQUEST
xmpp.browser.ERR_BAD_REQUEST
xmpp.commands.ERR_BAD_REQUEST
xmpp.dispatcher.ERR_BAD_REQUEST
xmpp.features.ERR_BAD_REQUEST
xmpp.filetransfer.ERR_BAD_REQUEST
xmpp.protocol.ERR_BAD_REQUEST
xmpp.roster.ERR_BAD_REQUEST
xmpp.session.ERR_BAD_REQUEST
xmpp.transports.ERR_BAD_REQUEST" class="py-name" href="#" onclick="return doclink('link-104', 'ERR_BAD_REQUEST', 'link-25');">ERR_BAD_REQUEST</a></tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L249"></a><tt class="py-lineno">249</tt>  <tt class="py-line">            <tt class="py-keyword">raise</tt> <tt id="link-105" class="py-name"><a title="xmpp.protocol.NodeProcessed" class="py-name" href="#" onclick="return doclink('link-105', 'NodeProcessed', 'link-26');">NodeProcessed</a></tt> </tt>
<a name="L250"></a><tt class="py-lineno">250</tt>  <tt class="py-line">        <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
<a name="L251"></a><tt class="py-lineno">251</tt>  <tt class="py-line">            <tt class="py-comment"># New session</tt> </tt>
<a name="L252"></a><tt class="py-lineno">252</tt>  <tt class="py-line"><tt class="py-comment"></tt>            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">initial</tt><tt class="py-op">[</tt><tt class="py-name">action</tt><tt class="py-op">]</tt><tt class="py-op">(</tt><tt class="py-name">conn</tt><tt class="py-op">,</tt><tt class="py-name">request</tt><tt class="py-op">)</tt> </tt>
</div><a name="L253"></a><tt class="py-lineno">253</tt>  <tt class="py-line"> </tt>
<a name="Command_Handler_Prototype._DiscoHandler"></a><div id="Command_Handler_Prototype._DiscoHandler-def"><a name="L254"></a><tt class="py-lineno">254</tt> <a class="py-toggle" href="#" id="Command_Handler_Prototype._DiscoHandler-toggle" onclick="return toggle('Command_Handler_Prototype._DiscoHandler');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="xmpp.commands.Command_Handler_Prototype-class.html#_DiscoHandler">_DiscoHandler</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt><tt class="py-param">conn</tt><tt class="py-op">,</tt><tt class="py-param">request</tt><tt class="py-op">,</tt><tt class="py-param">type</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="Command_Handler_Prototype._DiscoHandler-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="Command_Handler_Prototype._DiscoHandler-expanded"><a name="L255"></a><tt class="py-lineno">255</tt>  <tt class="py-line">        <tt class="py-docstring">"""The handler for discovery events"""</tt> </tt>
<a name="L256"></a><tt class="py-lineno">256</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">type</tt> <tt class="py-op">==</tt> <tt class="py-string">'list'</tt><tt class="py-op">:</tt> </tt>
<a name="L257"></a><tt class="py-lineno">257</tt>  <tt class="py-line">            <tt class="py-keyword">return</tt> <tt class="py-op">(</tt><tt class="py-name">request</tt><tt class="py-op">.</tt><tt id="link-106" class="py-name"><a title="xmpp.protocol.Protocol.getTo" class="py-name" href="#" onclick="return doclink('link-106', 'getTo', 'link-21');">getTo</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">,</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-107" class="py-name"><a title="xmpp.auth.name
xmpp.browser.name
xmpp.commands.Command_Handler_Prototype.name
xmpp.commands.TestCommand.name
xmpp.commands.name
xmpp.dispatcher.name
xmpp.features.name
xmpp.filetransfer.name
xmpp.name
xmpp.protocol.name
xmpp.roster.name
xmpp.session.name
xmpp.transports.name" class="py-name" href="#" onclick="return doclink('link-107', 'name', 'link-52');">name</a></tt><tt class="py-op">,</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-108" class="py-name"><a title="xmpp.commands.Command_Handler_Prototype.description
xmpp.commands.TestCommand.description" class="py-name" href="#" onclick="return doclink('link-108', 'description', 'link-66');">description</a></tt><tt class="py-op">)</tt> </tt>
<a name="L258"></a><tt class="py-lineno">258</tt>  <tt class="py-line">        <tt class="py-keyword">elif</tt> <tt class="py-name">type</tt> <tt class="py-op">==</tt> <tt class="py-string">'items'</tt><tt class="py-op">:</tt> </tt>
<a name="L259"></a><tt class="py-lineno">259</tt>  <tt class="py-line">            <tt class="py-keyword">return</tt> <tt class="py-op">[</tt><tt class="py-op">]</tt> </tt>
<a name="L260"></a><tt class="py-lineno">260</tt>  <tt class="py-line">        <tt class="py-keyword">elif</tt> <tt class="py-name">type</tt> <tt class="py-op">==</tt> <tt class="py-string">'info'</tt><tt class="py-op">:</tt> </tt>
<a name="L261"></a><tt class="py-lineno">261</tt>  <tt class="py-line">            <tt class="py-keyword">return</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">discoinfo</tt> </tt>
</div></div><a name="L262"></a><tt class="py-lineno">262</tt>  <tt class="py-line"> </tt>
<a name="TestCommand"></a><div id="TestCommand-def"><a name="L263"></a><tt class="py-lineno">263</tt> <a class="py-toggle" href="#" id="TestCommand-toggle" onclick="return toggle('TestCommand');">-</a><tt class="py-line"><tt class="py-keyword">class</tt> <a class="py-def-name" href="xmpp.commands.TestCommand-class.html">TestCommand</a><tt class="py-op">(</tt><tt class="py-base-class">Command_Handler_Prototype</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="TestCommand-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="TestCommand-expanded"><a name="L264"></a><tt class="py-lineno">264</tt>  <tt class="py-line">    <tt class="py-docstring">""" Example class. You should read source if you wish to understate how it works. </tt> </tt>
<a name="L265"></a><tt class="py-lineno">265</tt>  <tt class="py-line"><tt class="py-docstring">        Generally, it presents a "master" that giudes user through to calculate something.</tt> </tt>
<a name="L266"></a><tt class="py-lineno">266</tt>  <tt class="py-line"><tt class="py-docstring">    """</tt> </tt>
<a name="L267"></a><tt class="py-lineno">267</tt>  <tt class="py-line">    <tt id="link-109" class="py-name"><a title="xmpp.auth.name
xmpp.browser.name
xmpp.commands.Command_Handler_Prototype.name
xmpp.commands.TestCommand.name
xmpp.commands.name
xmpp.dispatcher.name
xmpp.features.name
xmpp.filetransfer.name
xmpp.name
xmpp.protocol.name
xmpp.roster.name
xmpp.session.name
xmpp.transports.name" class="py-name" href="#" onclick="return doclink('link-109', 'name', 'link-52');">name</a></tt> <tt class="py-op">=</tt> <tt class="py-string">'testcommand'</tt> </tt>
<a name="L268"></a><tt class="py-lineno">268</tt>  <tt class="py-line">    <tt id="link-110" class="py-name"><a title="xmpp.commands.Command_Handler_Prototype.description
xmpp.commands.TestCommand.description" class="py-name" href="#" onclick="return doclink('link-110', 'description', 'link-66');">description</a></tt> <tt class="py-op">=</tt> <tt class="py-string">'a noddy example command'</tt> </tt>
<a name="TestCommand.__init__"></a><div id="TestCommand.__init__-def"><a name="L269"></a><tt class="py-lineno">269</tt> <a class="py-toggle" href="#" id="TestCommand.__init__-toggle" onclick="return toggle('TestCommand.__init__');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="xmpp.commands.TestCommand-class.html#__init__">__init__</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt><tt class="py-param">jid</tt><tt class="py-op">=</tt><tt class="py-string">''</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="TestCommand.__init__-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="TestCommand.__init__-expanded"><a name="L270"></a><tt class="py-lineno">270</tt>  <tt class="py-line">        <tt class="py-docstring">""" Init internal constants. """</tt> </tt>
<a name="L271"></a><tt class="py-lineno">271</tt>  <tt class="py-line">        <tt id="link-111" class="py-name" targets="Class xmpp.commands.Command_Handler_Prototype=xmpp.commands.Command_Handler_Prototype-class.html"><a title="xmpp.commands.Command_Handler_Prototype" class="py-name" href="#" onclick="return doclink('link-111', 'Command_Handler_Prototype', 'link-111');">Command_Handler_Prototype</a></tt><tt class="py-op">.</tt><tt id="link-112" class="py-name"><a title="xmpp.auth.Bind.__init__
xmpp.auth.ComponentBind.__init__
xmpp.auth.NonSASL.__init__
xmpp.auth.SASL.__init__
xmpp.browser.Browser.__init__
xmpp.client.CommonClient.__init__
xmpp.client.Component.__init__
xmpp.client.PlugIn.__init__
xmpp.commands.Command_Handler_Prototype.__init__
xmpp.commands.Commands.__init__
xmpp.commands.TestCommand.__init__
xmpp.debug.Debug.__init__
xmpp.debug.NoDebug.__init__
xmpp.dispatcher.Dispatcher.__init__
xmpp.filetransfer.IBB.__init__
xmpp.protocol.DataField.__init__
xmpp.protocol.DataForm.__init__
xmpp.protocol.Error.__init__
xmpp.protocol.ErrorNode.__init__
xmpp.protocol.Iq.__init__
xmpp.protocol.JID.__init__
xmpp.protocol.Message.__init__
xmpp.protocol.Presence.__init__
xmpp.protocol.Protocol.__init__
xmpp.roster.Roster.__init__
xmpp.session.Session.__init__
xmpp.simplexml.Node.__init__
xmpp.simplexml.NodeBuilder.__init__
xmpp.simplexml.T.__init__
xmpp.transports.HTTPPROXYsocket.__init__
xmpp.transports.TCPsocket.__init__
xmpp.transports.error.__init__" class="py-name" href="#" onclick="return doclink('link-112', '__init__', 'link-4');">__init__</a></tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">,</tt><tt class="py-name">jid</tt><tt class="py-op">)</tt> </tt>
<a name="L272"></a><tt class="py-lineno">272</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">initial</tt> <tt class="py-op">=</tt> <tt class="py-op">{</tt><tt class="py-string">'execute'</tt><tt class="py-op">:</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-113" class="py-name" targets="Method xmpp.commands.TestCommand.cmdFirstStage()=xmpp.commands.TestCommand-class.html#cmdFirstStage"><a title="xmpp.commands.TestCommand.cmdFirstStage" class="py-name" href="#" onclick="return doclink('link-113', 'cmdFirstStage', 'link-113');">cmdFirstStage</a></tt><tt class="py-op">}</tt> </tt>
</div><a name="L273"></a><tt class="py-lineno">273</tt>  <tt class="py-line">     </tt>
<a name="TestCommand.cmdFirstStage"></a><div id="TestCommand.cmdFirstStage-def"><a name="L274"></a><tt class="py-lineno">274</tt> <a class="py-toggle" href="#" id="TestCommand.cmdFirstStage-toggle" onclick="return toggle('TestCommand.cmdFirstStage');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="xmpp.commands.TestCommand-class.html#cmdFirstStage">cmdFirstStage</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt><tt class="py-param">conn</tt><tt class="py-op">,</tt><tt class="py-param">request</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="TestCommand.cmdFirstStage-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="TestCommand.cmdFirstStage-expanded"><a name="L275"></a><tt class="py-lineno">275</tt>  <tt class="py-line">        <tt class="py-docstring">""" Determine """</tt> </tt>
<a name="L276"></a><tt class="py-lineno">276</tt>  <tt class="py-line">        <tt class="py-comment"># This is the only place this should be repeated as all other stages should have SessionIDs</tt> </tt>
<a name="L277"></a><tt class="py-lineno">277</tt>  <tt class="py-line"><tt class="py-comment"></tt>        <tt class="py-keyword">try</tt><tt class="py-op">:</tt> </tt>
<a name="L278"></a><tt class="py-lineno">278</tt>  <tt class="py-line">            <tt id="link-114" class="py-name"><a title="xmpp.session" class="py-name" href="#" onclick="return doclink('link-114', 'session', 'link-84');">session</a></tt> <tt class="py-op">=</tt> <tt class="py-name">request</tt><tt class="py-op">.</tt><tt id="link-115" class="py-name"><a title="xmpp.simplexml.Node.getTagAttr" class="py-name" href="#" onclick="return doclink('link-115', 'getTagAttr', 'link-22');">getTagAttr</a></tt><tt class="py-op">(</tt><tt class="py-string">'command'</tt><tt class="py-op">,</tt><tt class="py-string">'sessionid'</tt><tt class="py-op">)</tt> </tt>
<a name="L279"></a><tt class="py-lineno">279</tt>  <tt class="py-line">        <tt class="py-keyword">except</tt><tt class="py-op">:</tt> </tt>
<a name="L280"></a><tt class="py-lineno">280</tt>  <tt class="py-line">            <tt id="link-116" class="py-name"><a title="xmpp.session" class="py-name" href="#" onclick="return doclink('link-116', 'session', 'link-84');">session</a></tt> <tt class="py-op">=</tt> <tt class="py-name">None</tt> </tt>
<a name="L281"></a><tt class="py-lineno">281</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt id="link-117" class="py-name"><a title="xmpp.session" class="py-name" href="#" onclick="return doclink('link-117', 'session', 'link-84');">session</a></tt> <tt class="py-op">==</tt> <tt class="py-name">None</tt><tt class="py-op">:</tt> </tt>
<a name="L282"></a><tt class="py-lineno">282</tt>  <tt class="py-line">            <tt id="link-118" class="py-name"><a title="xmpp.session" class="py-name" href="#" onclick="return doclink('link-118', 'session', 'link-84');">session</a></tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-119" class="py-name" targets="Method xmpp.commands.Command_Handler_Prototype.getSessionID()=xmpp.commands.Command_Handler_Prototype-class.html#getSessionID"><a title="xmpp.commands.Command_Handler_Prototype.getSessionID" class="py-name" href="#" onclick="return doclink('link-119', 'getSessionID', 'link-119');">getSessionID</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L283"></a><tt class="py-lineno">283</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">sessions</tt><tt class="py-op">[</tt><tt id="link-120" class="py-name"><a title="xmpp.session" class="py-name" href="#" onclick="return doclink('link-120', 'session', 'link-84');">session</a></tt><tt class="py-op">]</tt><tt class="py-op">=</tt><tt class="py-op">{</tt><tt class="py-string">'jid'</tt><tt class="py-op">:</tt><tt class="py-name">request</tt><tt class="py-op">.</tt><tt id="link-121" class="py-name"><a title="xmpp.protocol.Protocol.getFrom" class="py-name" href="#" onclick="return doclink('link-121', 'getFrom', 'link-90');">getFrom</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">,</tt><tt class="py-string">'actions'</tt><tt class="py-op">:</tt><tt class="py-op">{</tt><tt class="py-string">'cancel'</tt><tt class="py-op">:</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-122" class="py-name" targets="Method xmpp.commands.TestCommand.cmdCancel()=xmpp.commands.TestCommand-class.html#cmdCancel"><a title="xmpp.commands.TestCommand.cmdCancel" class="py-name" href="#" onclick="return doclink('link-122', 'cmdCancel', 'link-122');">cmdCancel</a></tt><tt class="py-op">,</tt><tt class="py-string">'next'</tt><tt class="py-op">:</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-123" class="py-name" targets="Method xmpp.commands.TestCommand.cmdSecondStage()=xmpp.commands.TestCommand-class.html#cmdSecondStage"><a title="xmpp.commands.TestCommand.cmdSecondStage" class="py-name" href="#" onclick="return doclink('link-123', 'cmdSecondStage', 'link-123');">cmdSecondStage</a></tt><tt class="py-op">,</tt><tt class="py-string">'execute'</tt><tt class="py-op">:</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-124" class="py-name"><a title="xmpp.commands.TestCommand.cmdSecondStage" class="py-name" href="#" onclick="return doclink('link-124', 'cmdSecondStage', 'link-123');">cmdSecondStage</a></tt><tt class="py-op">}</tt><tt class="py-op">,</tt><tt class="py-string">'data'</tt><tt class="py-op">:</tt><tt class="py-op">{</tt><tt class="py-string">'type'</tt><tt class="py-op">:</tt><tt class="py-name">None</tt><tt class="py-op">}</tt><tt class="py-op">}</tt> </tt>
<a name="L284"></a><tt class="py-lineno">284</tt>  <tt class="py-line">        <tt class="py-comment"># As this is the first stage we only send a form</tt> </tt>
<a name="L285"></a><tt class="py-lineno">285</tt>  <tt class="py-line"><tt class="py-comment"></tt>        <tt class="py-name">reply</tt> <tt class="py-op">=</tt> <tt class="py-name">request</tt><tt class="py-op">.</tt><tt id="link-125" class="py-name"><a title="xmpp.protocol.Iq.buildReply
xmpp.protocol.Message.buildReply" class="py-name" href="#" onclick="return doclink('link-125', 'buildReply', 'link-39');">buildReply</a></tt><tt class="py-op">(</tt><tt class="py-string">'result'</tt><tt class="py-op">)</tt> </tt>
<a name="L286"></a><tt class="py-lineno">286</tt>  <tt class="py-line">        <tt class="py-name">form</tt> <tt class="py-op">=</tt> <tt id="link-126" class="py-name" targets="Class xmpp.protocol.DataForm=xmpp.protocol.DataForm-class.html"><a title="xmpp.protocol.DataForm" class="py-name" href="#" onclick="return doclink('link-126', 'DataForm', 'link-126');">DataForm</a></tt><tt class="py-op">(</tt><tt class="py-name">title</tt><tt class="py-op">=</tt><tt class="py-string">'Select type of operation'</tt><tt class="py-op">,</tt><tt class="py-name">data</tt><tt class="py-op">=</tt><tt class="py-op">[</tt><tt class="py-string">'Use the combobox to select the type of calculation you would like to do, then click Next'</tt><tt class="py-op">,</tt><tt id="link-127" class="py-name" targets="Class xmpp.protocol.DataField=xmpp.protocol.DataField-class.html"><a title="xmpp.protocol.DataField" class="py-name" href="#" onclick="return doclink('link-127', 'DataField', 'link-127');">DataField</a></tt><tt class="py-op">(</tt><tt id="link-128" class="py-name"><a title="xmpp.auth.name
xmpp.browser.name
xmpp.commands.Command_Handler_Prototype.name
xmpp.commands.TestCommand.name
xmpp.commands.name
xmpp.dispatcher.name
xmpp.features.name
xmpp.filetransfer.name
xmpp.name
xmpp.protocol.name
xmpp.roster.name
xmpp.session.name
xmpp.transports.name" class="py-name" href="#" onclick="return doclink('link-128', 'name', 'link-52');">name</a></tt><tt class="py-op">=</tt><tt class="py-string">'calctype'</tt><tt class="py-op">,</tt><tt class="py-name">desc</tt><tt class="py-op">=</tt><tt class="py-string">'Calculation Type'</tt><tt class="py-op">,</tt><tt class="py-name">value</tt><tt class="py-op">=</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">sessions</tt><tt class="py-op">[</tt><tt id="link-129" class="py-name"><a title="xmpp.session" class="py-name" href="#" onclick="return doclink('link-129', 'session', 'link-84');">session</a></tt><tt class="py-op">]</tt><tt class="py-op">[</tt><tt class="py-string">'data'</tt><tt class="py-op">]</tt><tt class="py-op">[</tt><tt class="py-string">'type'</tt><tt class="py-op">]</tt><tt class="py-op">,</tt><tt class="py-name">options</tt><tt class="py-op">=</tt><tt class="py-op">[</tt><tt class="py-op">[</tt><tt class="py-string">'circlediameter'</tt><tt class="py-op">,</tt><tt class="py-string">'Calculate the Diameter of a circle'</tt><tt class="py-op">]</tt><tt class="py-op">,</tt><tt class="py-op">[</tt><tt class="py-string">'circlearea'</tt><tt class="py-op">,</tt><tt class="py-string">'Calculate the area of a circle'</tt><tt class="py-op">]</tt><tt class="py-op">]</tt><tt class="py-op">,</tt><tt class="py-name">typ</tt><tt class="py-op">=</tt><tt class="py-string">'list-single'</tt><tt class="py-op">,</tt><tt class="py-name">required</tt><tt class="py-op">=</tt><tt class="py-number">1</tt><tt class="py-op">)</tt><tt class="py-op">]</tt><tt class="py-op">)</tt> </tt>
<a name="L287"></a><tt class="py-lineno">287</tt>  <tt class="py-line">        <tt class="py-name">replypayload</tt> <tt class="py-op">=</tt> <tt class="py-op">[</tt><tt id="link-130" class="py-name"><a title="xmpp.simplexml.Node" class="py-name" href="#" onclick="return doclink('link-130', 'Node', 'link-38');">Node</a></tt><tt class="py-op">(</tt><tt class="py-string">'actions'</tt><tt class="py-op">,</tt><tt class="py-name">attrs</tt><tt class="py-op">=</tt><tt class="py-op">{</tt><tt class="py-string">'execute'</tt><tt class="py-op">:</tt><tt class="py-string">'next'</tt><tt class="py-op">}</tt><tt class="py-op">,</tt><tt class="py-name">payload</tt><tt class="py-op">=</tt><tt class="py-op">[</tt><tt id="link-131" class="py-name"><a title="xmpp.simplexml.Node" class="py-name" href="#" onclick="return doclink('link-131', 'Node', 'link-38');">Node</a></tt><tt class="py-op">(</tt><tt class="py-string">'next'</tt><tt class="py-op">)</tt><tt class="py-op">]</tt><tt class="py-op">)</tt><tt class="py-op">,</tt><tt class="py-name">form</tt><tt class="py-op">]</tt> </tt>
<a name="L288"></a><tt class="py-lineno">288</tt>  <tt class="py-line">        <tt class="py-name">reply</tt><tt class="py-op">.</tt><tt id="link-132" class="py-name" targets="Method xmpp.simplexml.Node.addChild()=xmpp.simplexml.Node-class.html#addChild"><a title="xmpp.simplexml.Node.addChild" class="py-name" href="#" onclick="return doclink('link-132', 'addChild', 'link-132');">addChild</a></tt><tt class="py-op">(</tt><tt id="link-133" class="py-name"><a title="xmpp.auth.name
xmpp.browser.name
xmpp.commands.Command_Handler_Prototype.name
xmpp.commands.TestCommand.name
xmpp.commands.name
xmpp.dispatcher.name
xmpp.features.name
xmpp.filetransfer.name
xmpp.name
xmpp.protocol.name
xmpp.roster.name
xmpp.session.name
xmpp.transports.name" class="py-name" href="#" onclick="return doclink('link-133', 'name', 'link-52');">name</a></tt><tt class="py-op">=</tt><tt class="py-string">'command'</tt><tt class="py-op">,</tt><tt class="py-name">namespace</tt><tt class="py-op">=</tt><tt id="link-134" class="py-name"><a title="xmpp.protocol.NS_COMMANDS" class="py-name" href="#" onclick="return doclink('link-134', 'NS_COMMANDS', 'link-8');">NS_COMMANDS</a></tt><tt class="py-op">,</tt><tt class="py-name">attrs</tt><tt class="py-op">=</tt><tt class="py-op">{</tt><tt class="py-string">'node'</tt><tt class="py-op">:</tt><tt class="py-name">request</tt><tt class="py-op">.</tt><tt id="link-135" class="py-name"><a title="xmpp.simplexml.Node.getTagAttr" class="py-name" href="#" onclick="return doclink('link-135', 'getTagAttr', 'link-22');">getTagAttr</a></tt><tt class="py-op">(</tt><tt class="py-string">'command'</tt><tt class="py-op">,</tt><tt class="py-string">'node'</tt><tt class="py-op">)</tt><tt class="py-op">,</tt><tt class="py-string">'sessionid'</tt><tt class="py-op">:</tt><tt id="link-136" class="py-name"><a title="xmpp.session" class="py-name" href="#" onclick="return doclink('link-136', 'session', 'link-84');">session</a></tt><tt class="py-op">,</tt><tt class="py-string">'status'</tt><tt class="py-op">:</tt><tt class="py-string">'executing'</tt><tt class="py-op">}</tt><tt class="py-op">,</tt><tt class="py-name">payload</tt><tt class="py-op">=</tt><tt class="py-name">replypayload</tt><tt class="py-op">)</tt> </tt>
<a name="L289"></a><tt class="py-lineno">289</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_owner</tt><tt class="py-op">.</tt><tt id="link-137" class="py-name"><a title="xmpp.dispatcher.Dispatcher.send
xmpp.transports.TCPsocket.send" class="py-name" href="#" onclick="return doclink('link-137', 'send', 'link-23');">send</a></tt><tt class="py-op">(</tt><tt class="py-name">reply</tt><tt class="py-op">)</tt> </tt>
<a name="L290"></a><tt class="py-lineno">290</tt>  <tt class="py-line">        <tt class="py-keyword">raise</tt> <tt id="link-138" class="py-name"><a title="xmpp.protocol.NodeProcessed" class="py-name" href="#" onclick="return doclink('link-138', 'NodeProcessed', 'link-26');">NodeProcessed</a></tt> </tt>
</div><a name="L291"></a><tt class="py-lineno">291</tt>  <tt class="py-line"> </tt>
<a name="TestCommand.cmdSecondStage"></a><div id="TestCommand.cmdSecondStage-def"><a name="L292"></a><tt class="py-lineno">292</tt> <a class="py-toggle" href="#" id="TestCommand.cmdSecondStage-toggle" onclick="return toggle('TestCommand.cmdSecondStage');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="xmpp.commands.TestCommand-class.html#cmdSecondStage">cmdSecondStage</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt><tt class="py-param">conn</tt><tt class="py-op">,</tt><tt class="py-param">request</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="TestCommand.cmdSecondStage-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="TestCommand.cmdSecondStage-expanded"><a name="L293"></a><tt class="py-lineno">293</tt>  <tt class="py-line">        <tt class="py-name">form</tt> <tt class="py-op">=</tt> <tt id="link-139" class="py-name"><a title="xmpp.protocol.DataForm" class="py-name" href="#" onclick="return doclink('link-139', 'DataForm', 'link-126');">DataForm</a></tt><tt class="py-op">(</tt><tt class="py-name">node</tt> <tt class="py-op">=</tt> <tt class="py-name">request</tt><tt class="py-op">.</tt><tt id="link-140" class="py-name" targets="Method xmpp.simplexml.Node.getTag()=xmpp.simplexml.Node-class.html#getTag"><a title="xmpp.simplexml.Node.getTag" class="py-name" href="#" onclick="return doclink('link-140', 'getTag', 'link-140');">getTag</a></tt><tt class="py-op">(</tt><tt id="link-141" class="py-name"><a title="xmpp.auth.name
xmpp.browser.name
xmpp.commands.Command_Handler_Prototype.name
xmpp.commands.TestCommand.name
xmpp.commands.name
xmpp.dispatcher.name
xmpp.features.name
xmpp.filetransfer.name
xmpp.name
xmpp.protocol.name
xmpp.roster.name
xmpp.session.name
xmpp.transports.name" class="py-name" href="#" onclick="return doclink('link-141', 'name', 'link-52');">name</a></tt><tt class="py-op">=</tt><tt class="py-string">'command'</tt><tt class="py-op">)</tt><tt class="py-op">.</tt><tt id="link-142" class="py-name"><a title="xmpp.simplexml.Node.getTag" class="py-name" href="#" onclick="return doclink('link-142', 'getTag', 'link-140');">getTag</a></tt><tt class="py-op">(</tt><tt id="link-143" class="py-name"><a title="xmpp.auth.name
xmpp.browser.name
xmpp.commands.Command_Handler_Prototype.name
xmpp.commands.TestCommand.name
xmpp.commands.name
xmpp.dispatcher.name
xmpp.features.name
xmpp.filetransfer.name
xmpp.name
xmpp.protocol.name
xmpp.roster.name
xmpp.session.name
xmpp.transports.name" class="py-name" href="#" onclick="return doclink('link-143', 'name', 'link-52');">name</a></tt><tt class="py-op">=</tt><tt class="py-string">'x'</tt><tt class="py-op">,</tt><tt class="py-name">namespace</tt><tt class="py-op">=</tt><tt id="link-144" class="py-name"><a title="xmpp.protocol.NS_DATA" class="py-name" href="#" onclick="return doclink('link-144', 'NS_DATA', 'link-69');">NS_DATA</a></tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L294"></a><tt class="py-lineno">294</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">sessions</tt><tt class="py-op">[</tt><tt class="py-name">request</tt><tt class="py-op">.</tt><tt id="link-145" class="py-name"><a title="xmpp.simplexml.Node.getTagAttr" class="py-name" href="#" onclick="return doclink('link-145', 'getTagAttr', 'link-22');">getTagAttr</a></tt><tt class="py-op">(</tt><tt class="py-string">'command'</tt><tt class="py-op">,</tt><tt class="py-string">'sessionid'</tt><tt class="py-op">)</tt><tt class="py-op">]</tt><tt class="py-op">[</tt><tt class="py-string">'data'</tt><tt class="py-op">]</tt><tt class="py-op">[</tt><tt class="py-string">'type'</tt><tt class="py-op">]</tt><tt class="py-op">=</tt><tt class="py-name">form</tt><tt class="py-op">.</tt><tt id="link-146" class="py-name" targets="Method xmpp.protocol.DataForm.getField()=xmpp.protocol.DataForm-class.html#getField"><a title="xmpp.protocol.DataForm.getField" class="py-name" href="#" onclick="return doclink('link-146', 'getField', 'link-146');">getField</a></tt><tt class="py-op">(</tt><tt class="py-string">'calctype'</tt><tt class="py-op">)</tt><tt class="py-op">.</tt><tt id="link-147" class="py-name" targets="Method xmpp.protocol.DataField.getValue()=xmpp.protocol.DataField-class.html#getValue"><a title="xmpp.protocol.DataField.getValue" class="py-name" href="#" onclick="return doclink('link-147', 'getValue', 'link-147');">getValue</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L295"></a><tt class="py-lineno">295</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">sessions</tt><tt class="py-op">[</tt><tt class="py-name">request</tt><tt class="py-op">.</tt><tt id="link-148" class="py-name"><a title="xmpp.simplexml.Node.getTagAttr" class="py-name" href="#" onclick="return doclink('link-148', 'getTagAttr', 'link-22');">getTagAttr</a></tt><tt class="py-op">(</tt><tt class="py-string">'command'</tt><tt class="py-op">,</tt><tt class="py-string">'sessionid'</tt><tt class="py-op">)</tt><tt class="py-op">]</tt><tt class="py-op">[</tt><tt class="py-string">'actions'</tt><tt class="py-op">]</tt><tt class="py-op">=</tt><tt class="py-op">{</tt><tt class="py-string">'cancel'</tt><tt class="py-op">:</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-149" class="py-name"><a title="xmpp.commands.TestCommand.cmdCancel" class="py-name" href="#" onclick="return doclink('link-149', 'cmdCancel', 'link-122');">cmdCancel</a></tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">:</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-150" class="py-name" targets="Method xmpp.commands.TestCommand.cmdThirdStage()=xmpp.commands.TestCommand-class.html#cmdThirdStage"><a title="xmpp.commands.TestCommand.cmdThirdStage" class="py-name" href="#" onclick="return doclink('link-150', 'cmdThirdStage', 'link-150');">cmdThirdStage</a></tt><tt class="py-op">,</tt><tt class="py-string">'previous'</tt><tt class="py-op">:</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-151" class="py-name"><a title="xmpp.commands.TestCommand.cmdFirstStage" class="py-name" href="#" onclick="return doclink('link-151', 'cmdFirstStage', 'link-113');">cmdFirstStage</a></tt><tt class="py-op">,</tt><tt class="py-string">'execute'</tt><tt class="py-op">:</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-152" class="py-name"><a title="xmpp.commands.TestCommand.cmdThirdStage" class="py-name" href="#" onclick="return doclink('link-152', 'cmdThirdStage', 'link-150');">cmdThirdStage</a></tt><tt class="py-op">,</tt><tt class="py-string">'next'</tt><tt class="py-op">:</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-153" class="py-name"><a title="xmpp.commands.TestCommand.cmdThirdStage" class="py-name" href="#" onclick="return doclink('link-153', 'cmdThirdStage', 'link-150');">cmdThirdStage</a></tt><tt class="py-op">}</tt> </tt>
<a name="L296"></a><tt class="py-lineno">296</tt>  <tt class="py-line">        <tt class="py-comment"># The form generation is split out to another method as it may be called by cmdThirdStage</tt> </tt>
<a name="L297"></a><tt class="py-lineno">297</tt>  <tt class="py-line"><tt class="py-comment"></tt>        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-154" class="py-name" targets="Method xmpp.commands.TestCommand.cmdSecondStageReply()=xmpp.commands.TestCommand-class.html#cmdSecondStageReply"><a title="xmpp.commands.TestCommand.cmdSecondStageReply" class="py-name" href="#" onclick="return doclink('link-154', 'cmdSecondStageReply', 'link-154');">cmdSecondStageReply</a></tt><tt class="py-op">(</tt><tt class="py-name">conn</tt><tt class="py-op">,</tt><tt class="py-name">request</tt><tt class="py-op">)</tt> </tt>
</div><a name="L298"></a><tt class="py-lineno">298</tt>  <tt class="py-line"> </tt>
<a name="TestCommand.cmdSecondStageReply"></a><div id="TestCommand.cmdSecondStageReply-def"><a name="L299"></a><tt class="py-lineno">299</tt> <a class="py-toggle" href="#" id="TestCommand.cmdSecondStageReply-toggle" onclick="return toggle('TestCommand.cmdSecondStageReply');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="xmpp.commands.TestCommand-class.html#cmdSecondStageReply">cmdSecondStageReply</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt><tt class="py-param">conn</tt><tt class="py-op">,</tt><tt class="py-param">request</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="TestCommand.cmdSecondStageReply-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="TestCommand.cmdSecondStageReply-expanded"><a name="L300"></a><tt class="py-lineno">300</tt>  <tt class="py-line">        <tt class="py-name">reply</tt> <tt class="py-op">=</tt> <tt class="py-name">request</tt><tt class="py-op">.</tt><tt id="link-155" class="py-name"><a title="xmpp.protocol.Iq.buildReply
xmpp.protocol.Message.buildReply" class="py-name" href="#" onclick="return doclink('link-155', 'buildReply', 'link-39');">buildReply</a></tt><tt class="py-op">(</tt><tt class="py-string">'result'</tt><tt class="py-op">)</tt> </tt>
<a name="L301"></a><tt class="py-lineno">301</tt>  <tt class="py-line">        <tt class="py-name">form</tt> <tt class="py-op">=</tt> <tt id="link-156" class="py-name"><a title="xmpp.protocol.DataForm" class="py-name" href="#" onclick="return doclink('link-156', 'DataForm', 'link-126');">DataForm</a></tt><tt class="py-op">(</tt><tt class="py-name">title</tt> <tt class="py-op">=</tt> <tt class="py-string">'Enter the radius'</tt><tt class="py-op">,</tt> <tt class="py-name">data</tt><tt class="py-op">=</tt><tt class="py-op">[</tt><tt class="py-string">'Enter the radius of the circle (numbers only)'</tt><tt class="py-op">,</tt><tt id="link-157" class="py-name"><a title="xmpp.protocol.DataField" class="py-name" href="#" onclick="return doclink('link-157', 'DataField', 'link-127');">DataField</a></tt><tt class="py-op">(</tt><tt class="py-name">desc</tt><tt class="py-op">=</tt><tt class="py-string">'Radius'</tt><tt class="py-op">,</tt><tt id="link-158" class="py-name"><a title="xmpp.auth.name
xmpp.browser.name
xmpp.commands.Command_Handler_Prototype.name
xmpp.commands.TestCommand.name
xmpp.commands.name
xmpp.dispatcher.name
xmpp.features.name
xmpp.filetransfer.name
xmpp.name
xmpp.protocol.name
xmpp.roster.name
xmpp.session.name
xmpp.transports.name" class="py-name" href="#" onclick="return doclink('link-158', 'name', 'link-52');">name</a></tt><tt class="py-op">=</tt><tt class="py-string">'radius'</tt><tt class="py-op">,</tt><tt class="py-name">typ</tt><tt class="py-op">=</tt><tt class="py-string">'text-single'</tt><tt class="py-op">)</tt><tt class="py-op">]</tt><tt class="py-op">)</tt> </tt>
<a name="L302"></a><tt class="py-lineno">302</tt>  <tt class="py-line">        <tt class="py-name">replypayload</tt> <tt class="py-op">=</tt> <tt class="py-op">[</tt><tt id="link-159" class="py-name"><a title="xmpp.simplexml.Node" class="py-name" href="#" onclick="return doclink('link-159', 'Node', 'link-38');">Node</a></tt><tt class="py-op">(</tt><tt class="py-string">'actions'</tt><tt class="py-op">,</tt><tt class="py-name">attrs</tt><tt class="py-op">=</tt><tt class="py-op">{</tt><tt class="py-string">'execute'</tt><tt class="py-op">:</tt><tt class="py-string">'complete'</tt><tt class="py-op">}</tt><tt class="py-op">,</tt><tt class="py-name">payload</tt><tt class="py-op">=</tt><tt class="py-op">[</tt><tt id="link-160" class="py-name"><a title="xmpp.simplexml.Node" class="py-name" href="#" onclick="return doclink('link-160', 'Node', 'link-38');">Node</a></tt><tt class="py-op">(</tt><tt class="py-string">'complete'</tt><tt class="py-op">)</tt><tt class="py-op">,</tt><tt id="link-161" class="py-name"><a title="xmpp.simplexml.Node" class="py-name" href="#" onclick="return doclink('link-161', 'Node', 'link-38');">Node</a></tt><tt class="py-op">(</tt><tt class="py-string">'prev'</tt><tt class="py-op">)</tt><tt class="py-op">]</tt><tt class="py-op">)</tt><tt class="py-op">,</tt><tt class="py-name">form</tt><tt class="py-op">]</tt> </tt>
<a name="L303"></a><tt class="py-lineno">303</tt>  <tt class="py-line">        <tt class="py-name">reply</tt><tt class="py-op">.</tt><tt id="link-162" class="py-name"><a title="xmpp.simplexml.Node.addChild" class="py-name" href="#" onclick="return doclink('link-162', 'addChild', 'link-132');">addChild</a></tt><tt class="py-op">(</tt><tt id="link-163" class="py-name"><a title="xmpp.auth.name
xmpp.browser.name
xmpp.commands.Command_Handler_Prototype.name
xmpp.commands.TestCommand.name
xmpp.commands.name
xmpp.dispatcher.name
xmpp.features.name
xmpp.filetransfer.name
xmpp.name
xmpp.protocol.name
xmpp.roster.name
xmpp.session.name
xmpp.transports.name" class="py-name" href="#" onclick="return doclink('link-163', 'name', 'link-52');">name</a></tt><tt class="py-op">=</tt><tt class="py-string">'command'</tt><tt class="py-op">,</tt><tt class="py-name">namespace</tt><tt class="py-op">=</tt><tt id="link-164" class="py-name"><a title="xmpp.protocol.NS_COMMANDS" class="py-name" href="#" onclick="return doclink('link-164', 'NS_COMMANDS', 'link-8');">NS_COMMANDS</a></tt><tt class="py-op">,</tt><tt class="py-name">attrs</tt><tt class="py-op">=</tt><tt class="py-op">{</tt><tt class="py-string">'node'</tt><tt class="py-op">:</tt><tt class="py-name">request</tt><tt class="py-op">.</tt><tt id="link-165" class="py-name"><a title="xmpp.simplexml.Node.getTagAttr" class="py-name" href="#" onclick="return doclink('link-165', 'getTagAttr', 'link-22');">getTagAttr</a></tt><tt class="py-op">(</tt><tt class="py-string">'command'</tt><tt class="py-op">,</tt><tt class="py-string">'node'</tt><tt class="py-op">)</tt><tt class="py-op">,</tt><tt class="py-string">'sessionid'</tt><tt class="py-op">:</tt><tt class="py-name">request</tt><tt class="py-op">.</tt><tt id="link-166" class="py-name"><a title="xmpp.simplexml.Node.getTagAttr" class="py-name" href="#" onclick="return doclink('link-166', 'getTagAttr', 'link-22');">getTagAttr</a></tt><tt class="py-op">(</tt><tt class="py-string">'command'</tt><tt class="py-op">,</tt><tt class="py-string">'sessionid'</tt><tt class="py-op">)</tt><tt class="py-op">,</tt><tt class="py-string">'status'</tt><tt class="py-op">:</tt><tt class="py-string">'executing'</tt><tt class="py-op">}</tt><tt class="py-op">,</tt><tt class="py-name">payload</tt><tt class="py-op">=</tt><tt class="py-name">replypayload</tt><tt class="py-op">)</tt> </tt>
<a name="L304"></a><tt class="py-lineno">304</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_owner</tt><tt class="py-op">.</tt><tt id="link-167" class="py-name"><a title="xmpp.dispatcher.Dispatcher.send
xmpp.transports.TCPsocket.send" class="py-name" href="#" onclick="return doclink('link-167', 'send', 'link-23');">send</a></tt><tt class="py-op">(</tt><tt class="py-name">reply</tt><tt class="py-op">)</tt> </tt>
<a name="L305"></a><tt class="py-lineno">305</tt>  <tt class="py-line">        <tt class="py-keyword">raise</tt> <tt id="link-168" class="py-name"><a title="xmpp.protocol.NodeProcessed" class="py-name" href="#" onclick="return doclink('link-168', 'NodeProcessed', 'link-26');">NodeProcessed</a></tt> </tt>
</div><a name="L306"></a><tt class="py-lineno">306</tt>  <tt class="py-line"> </tt>
<a name="TestCommand.cmdThirdStage"></a><div id="TestCommand.cmdThirdStage-def"><a name="L307"></a><tt class="py-lineno">307</tt> <a class="py-toggle" href="#" id="TestCommand.cmdThirdStage-toggle" onclick="return toggle('TestCommand.cmdThirdStage');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="xmpp.commands.TestCommand-class.html#cmdThirdStage">cmdThirdStage</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt><tt class="py-param">conn</tt><tt class="py-op">,</tt><tt class="py-param">request</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="TestCommand.cmdThirdStage-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="TestCommand.cmdThirdStage-expanded"><a name="L308"></a><tt class="py-lineno">308</tt>  <tt class="py-line">        <tt class="py-name">form</tt> <tt class="py-op">=</tt> <tt id="link-169" class="py-name"><a title="xmpp.protocol.DataForm" class="py-name" href="#" onclick="return doclink('link-169', 'DataForm', 'link-126');">DataForm</a></tt><tt class="py-op">(</tt><tt class="py-name">node</tt> <tt class="py-op">=</tt> <tt class="py-name">request</tt><tt class="py-op">.</tt><tt id="link-170" class="py-name"><a title="xmpp.simplexml.Node.getTag" class="py-name" href="#" onclick="return doclink('link-170', 'getTag', 'link-140');">getTag</a></tt><tt class="py-op">(</tt><tt id="link-171" class="py-name"><a title="xmpp.auth.name
xmpp.browser.name
xmpp.commands.Command_Handler_Prototype.name
xmpp.commands.TestCommand.name
xmpp.commands.name
xmpp.dispatcher.name
xmpp.features.name
xmpp.filetransfer.name
xmpp.name
xmpp.protocol.name
xmpp.roster.name
xmpp.session.name
xmpp.transports.name" class="py-name" href="#" onclick="return doclink('link-171', 'name', 'link-52');">name</a></tt><tt class="py-op">=</tt><tt class="py-string">'command'</tt><tt class="py-op">)</tt><tt class="py-op">.</tt><tt id="link-172" class="py-name"><a title="xmpp.simplexml.Node.getTag" class="py-name" href="#" onclick="return doclink('link-172', 'getTag', 'link-140');">getTag</a></tt><tt class="py-op">(</tt><tt id="link-173" class="py-name"><a title="xmpp.auth.name
xmpp.browser.name
xmpp.commands.Command_Handler_Prototype.name
xmpp.commands.TestCommand.name
xmpp.commands.name
xmpp.dispatcher.name
xmpp.features.name
xmpp.filetransfer.name
xmpp.name
xmpp.protocol.name
xmpp.roster.name
xmpp.session.name
xmpp.transports.name" class="py-name" href="#" onclick="return doclink('link-173', 'name', 'link-52');">name</a></tt><tt class="py-op">=</tt><tt class="py-string">'x'</tt><tt class="py-op">,</tt><tt class="py-name">namespace</tt><tt class="py-op">=</tt><tt id="link-174" class="py-name"><a title="xmpp.protocol.NS_DATA" class="py-name" href="#" onclick="return doclink('link-174', 'NS_DATA', 'link-69');">NS_DATA</a></tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L309"></a><tt class="py-lineno">309</tt>  <tt class="py-line">        <tt class="py-keyword">try</tt><tt class="py-op">:</tt> </tt>
<a name="L310"></a><tt class="py-lineno">310</tt>  <tt class="py-line">            <tt class="py-name">num</tt> <tt class="py-op">=</tt> <tt class="py-name">float</tt><tt class="py-op">(</tt><tt class="py-name">form</tt><tt class="py-op">.</tt><tt id="link-175" class="py-name"><a title="xmpp.protocol.DataForm.getField" class="py-name" href="#" onclick="return doclink('link-175', 'getField', 'link-146');">getField</a></tt><tt class="py-op">(</tt><tt class="py-string">'radius'</tt><tt class="py-op">)</tt><tt class="py-op">.</tt><tt id="link-176" class="py-name"><a title="xmpp.protocol.DataField.getValue" class="py-name" href="#" onclick="return doclink('link-176', 'getValue', 'link-147');">getValue</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L311"></a><tt class="py-lineno">311</tt>  <tt class="py-line">        <tt class="py-keyword">except</tt><tt class="py-op">:</tt> </tt>
<a name="L312"></a><tt class="py-lineno">312</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-177" class="py-name"><a title="xmpp.commands.TestCommand.cmdSecondStageReply" class="py-name" href="#" onclick="return doclink('link-177', 'cmdSecondStageReply', 'link-154');">cmdSecondStageReply</a></tt><tt class="py-op">(</tt><tt class="py-name">conn</tt><tt class="py-op">,</tt><tt class="py-name">request</tt><tt class="py-op">)</tt> </tt>
<a name="L313"></a><tt class="py-lineno">313</tt>  <tt class="py-line">        <tt class="py-keyword">from</tt> <tt class="py-name">math</tt> <tt class="py-keyword">import</tt> <tt class="py-name">pi</tt> </tt>
<a name="L314"></a><tt class="py-lineno">314</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">sessions</tt><tt class="py-op">[</tt><tt class="py-name">request</tt><tt class="py-op">.</tt><tt id="link-178" class="py-name"><a title="xmpp.simplexml.Node.getTagAttr" class="py-name" href="#" onclick="return doclink('link-178', 'getTagAttr', 'link-22');">getTagAttr</a></tt><tt class="py-op">(</tt><tt class="py-string">'command'</tt><tt class="py-op">,</tt><tt class="py-string">'sessionid'</tt><tt class="py-op">)</tt><tt class="py-op">]</tt><tt class="py-op">[</tt><tt class="py-string">'data'</tt><tt class="py-op">]</tt><tt class="py-op">[</tt><tt class="py-string">'type'</tt><tt class="py-op">]</tt> <tt class="py-op">==</tt> <tt class="py-string">'circlearea'</tt><tt class="py-op">:</tt> </tt>
<a name="L315"></a><tt class="py-lineno">315</tt>  <tt class="py-line">            <tt class="py-name">result</tt> <tt class="py-op">=</tt> <tt class="py-op">(</tt><tt class="py-name">num</tt><tt class="py-op">**</tt><tt class="py-number">2</tt><tt class="py-op">)</tt><tt class="py-op">*</tt><tt class="py-name">pi</tt> </tt>
<a name="L316"></a><tt class="py-lineno">316</tt>  <tt class="py-line">        <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
<a name="L317"></a><tt class="py-lineno">317</tt>  <tt class="py-line">            <tt class="py-name">result</tt> <tt class="py-op">=</tt> <tt class="py-name">num</tt><tt class="py-op">*</tt><tt class="py-number">2</tt><tt class="py-op">*</tt><tt class="py-name">pi</tt> </tt>
<a name="L318"></a><tt class="py-lineno">318</tt>  <tt class="py-line">        <tt class="py-name">reply</tt> <tt class="py-op">=</tt> <tt class="py-name">request</tt><tt class="py-op">.</tt><tt id="link-179" class="py-name"><a title="xmpp.protocol.Iq.buildReply
xmpp.protocol.Message.buildReply" class="py-name" href="#" onclick="return doclink('link-179', 'buildReply', 'link-39');">buildReply</a></tt><tt class="py-op">(</tt><tt class="py-string">'result'</tt><tt class="py-op">)</tt> </tt>
<a name="L319"></a><tt class="py-lineno">319</tt>  <tt class="py-line">        <tt class="py-name">form</tt> <tt class="py-op">=</tt> <tt id="link-180" class="py-name"><a title="xmpp.protocol.DataForm" class="py-name" href="#" onclick="return doclink('link-180', 'DataForm', 'link-126');">DataForm</a></tt><tt class="py-op">(</tt><tt class="py-name">typ</tt><tt class="py-op">=</tt><tt class="py-string">'result'</tt><tt class="py-op">,</tt><tt class="py-name">data</tt><tt class="py-op">=</tt><tt class="py-op">[</tt><tt id="link-181" class="py-name"><a title="xmpp.protocol.DataField" class="py-name" href="#" onclick="return doclink('link-181', 'DataField', 'link-127');">DataField</a></tt><tt class="py-op">(</tt><tt class="py-name">desc</tt><tt class="py-op">=</tt><tt class="py-string">'result'</tt><tt class="py-op">,</tt><tt id="link-182" class="py-name"><a title="xmpp.auth.name
xmpp.browser.name
xmpp.commands.Command_Handler_Prototype.name
xmpp.commands.TestCommand.name
xmpp.commands.name
xmpp.dispatcher.name
xmpp.features.name
xmpp.filetransfer.name
xmpp.name
xmpp.protocol.name
xmpp.roster.name
xmpp.session.name
xmpp.transports.name" class="py-name" href="#" onclick="return doclink('link-182', 'name', 'link-52');">name</a></tt><tt class="py-op">=</tt><tt class="py-string">'result'</tt><tt class="py-op">,</tt><tt class="py-name">value</tt><tt class="py-op">=</tt><tt class="py-name">result</tt><tt class="py-op">)</tt><tt class="py-op">]</tt><tt class="py-op">)</tt> </tt>
<a name="L320"></a><tt class="py-lineno">320</tt>  <tt class="py-line">        <tt class="py-name">reply</tt><tt class="py-op">.</tt><tt id="link-183" class="py-name"><a title="xmpp.simplexml.Node.addChild" class="py-name" href="#" onclick="return doclink('link-183', 'addChild', 'link-132');">addChild</a></tt><tt class="py-op">(</tt><tt id="link-184" class="py-name"><a title="xmpp.auth.name
xmpp.browser.name
xmpp.commands.Command_Handler_Prototype.name
xmpp.commands.TestCommand.name
xmpp.commands.name
xmpp.dispatcher.name
xmpp.features.name
xmpp.filetransfer.name
xmpp.name
xmpp.protocol.name
xmpp.roster.name
xmpp.session.name
xmpp.transports.name" class="py-name" href="#" onclick="return doclink('link-184', 'name', 'link-52');">name</a></tt><tt class="py-op">=</tt><tt class="py-string">'command'</tt><tt class="py-op">,</tt><tt class="py-name">namespace</tt><tt class="py-op">=</tt><tt id="link-185" class="py-name"><a title="xmpp.protocol.NS_COMMANDS" class="py-name" href="#" onclick="return doclink('link-185', 'NS_COMMANDS', 'link-8');">NS_COMMANDS</a></tt><tt class="py-op">,</tt><tt class="py-name">attrs</tt><tt class="py-op">=</tt><tt class="py-op">{</tt><tt class="py-string">'node'</tt><tt class="py-op">:</tt><tt class="py-name">request</tt><tt class="py-op">.</tt><tt id="link-186" class="py-name"><a title="xmpp.simplexml.Node.getTagAttr" class="py-name" href="#" onclick="return doclink('link-186', 'getTagAttr', 'link-22');">getTagAttr</a></tt><tt class="py-op">(</tt><tt class="py-string">'command'</tt><tt class="py-op">,</tt><tt class="py-string">'node'</tt><tt class="py-op">)</tt><tt class="py-op">,</tt><tt class="py-string">'sessionid'</tt><tt class="py-op">:</tt><tt class="py-name">request</tt><tt class="py-op">.</tt><tt id="link-187" class="py-name"><a title="xmpp.simplexml.Node.getTagAttr" class="py-name" href="#" onclick="return doclink('link-187', 'getTagAttr', 'link-22');">getTagAttr</a></tt><tt class="py-op">(</tt><tt class="py-string">'command'</tt><tt class="py-op">,</tt><tt class="py-string">'sessionid'</tt><tt class="py-op">)</tt><tt class="py-op">,</tt><tt class="py-string">'status'</tt><tt class="py-op">:</tt><tt class="py-string">'completed'</tt><tt class="py-op">}</tt><tt class="py-op">,</tt><tt class="py-name">payload</tt><tt class="py-op">=</tt><tt class="py-op">[</tt><tt class="py-name">form</tt><tt class="py-op">]</tt><tt class="py-op">)</tt> </tt>
<a name="L321"></a><tt class="py-lineno">321</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_owner</tt><tt class="py-op">.</tt><tt id="link-188" class="py-name"><a title="xmpp.dispatcher.Dispatcher.send
xmpp.transports.TCPsocket.send" class="py-name" href="#" onclick="return doclink('link-188', 'send', 'link-23');">send</a></tt><tt class="py-op">(</tt><tt class="py-name">reply</tt><tt class="py-op">)</tt> </tt>
<a name="L322"></a><tt class="py-lineno">322</tt>  <tt class="py-line">        <tt class="py-keyword">raise</tt> <tt id="link-189" class="py-name"><a title="xmpp.protocol.NodeProcessed" class="py-name" href="#" onclick="return doclink('link-189', 'NodeProcessed', 'link-26');">NodeProcessed</a></tt> </tt>
</div><a name="L323"></a><tt class="py-lineno">323</tt>  <tt class="py-line"> </tt>
<a name="TestCommand.cmdCancel"></a><div id="TestCommand.cmdCancel-def"><a name="L324"></a><tt class="py-lineno">324</tt> <a class="py-toggle" href="#" id="TestCommand.cmdCancel-toggle" onclick="return toggle('TestCommand.cmdCancel');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="xmpp.commands.TestCommand-class.html#cmdCancel">cmdCancel</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt><tt class="py-param">conn</tt><tt class="py-op">,</tt><tt class="py-param">request</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="TestCommand.cmdCancel-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="TestCommand.cmdCancel-expanded"><a name="L325"></a><tt class="py-lineno">325</tt>  <tt class="py-line">        <tt class="py-name">reply</tt> <tt class="py-op">=</tt> <tt class="py-name">request</tt><tt class="py-op">.</tt><tt id="link-190" class="py-name"><a title="xmpp.protocol.Iq.buildReply
xmpp.protocol.Message.buildReply" class="py-name" href="#" onclick="return doclink('link-190', 'buildReply', 'link-39');">buildReply</a></tt><tt class="py-op">(</tt><tt class="py-string">'result'</tt><tt class="py-op">)</tt> </tt>
<a name="L326"></a><tt class="py-lineno">326</tt>  <tt class="py-line">        <tt class="py-name">reply</tt><tt class="py-op">.</tt><tt id="link-191" class="py-name"><a title="xmpp.simplexml.Node.addChild" class="py-name" href="#" onclick="return doclink('link-191', 'addChild', 'link-132');">addChild</a></tt><tt class="py-op">(</tt><tt id="link-192" class="py-name"><a title="xmpp.auth.name
xmpp.browser.name
xmpp.commands.Command_Handler_Prototype.name
xmpp.commands.TestCommand.name
xmpp.commands.name
xmpp.dispatcher.name
xmpp.features.name
xmpp.filetransfer.name
xmpp.name
xmpp.protocol.name
xmpp.roster.name
xmpp.session.name
xmpp.transports.name" class="py-name" href="#" onclick="return doclink('link-192', 'name', 'link-52');">name</a></tt><tt class="py-op">=</tt><tt class="py-string">'command'</tt><tt class="py-op">,</tt><tt class="py-name">namespace</tt><tt class="py-op">=</tt><tt id="link-193" class="py-name"><a title="xmpp.protocol.NS_COMMANDS" class="py-name" href="#" onclick="return doclink('link-193', 'NS_COMMANDS', 'link-8');">NS_COMMANDS</a></tt><tt class="py-op">,</tt><tt class="py-name">attrs</tt><tt class="py-op">=</tt><tt class="py-op">{</tt><tt class="py-string">'node'</tt><tt class="py-op">:</tt><tt class="py-name">request</tt><tt class="py-op">.</tt><tt id="link-194" class="py-name"><a title="xmpp.simplexml.Node.getTagAttr" class="py-name" href="#" onclick="return doclink('link-194', 'getTagAttr', 'link-22');">getTagAttr</a></tt><tt class="py-op">(</tt><tt class="py-string">'command'</tt><tt class="py-op">,</tt><tt class="py-string">'node'</tt><tt class="py-op">)</tt><tt class="py-op">,</tt><tt class="py-string">'sessionid'</tt><tt class="py-op">:</tt><tt class="py-name">request</tt><tt class="py-op">.</tt><tt id="link-195" class="py-name"><a title="xmpp.simplexml.Node.getTagAttr" class="py-name" href="#" onclick="return doclink('link-195', 'getTagAttr', 'link-22');">getTagAttr</a></tt><tt class="py-op">(</tt><tt class="py-string">'command'</tt><tt class="py-op">,</tt><tt class="py-string">'sessionid'</tt><tt class="py-op">)</tt><tt class="py-op">,</tt><tt class="py-string">'status'</tt><tt class="py-op">:</tt><tt class="py-string">'cancelled'</tt><tt class="py-op">}</tt><tt class="py-op">)</tt> </tt>
<a name="L327"></a><tt class="py-lineno">327</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_owner</tt><tt class="py-op">.</tt><tt id="link-196" class="py-name"><a title="xmpp.dispatcher.Dispatcher.send
xmpp.transports.TCPsocket.send" class="py-name" href="#" onclick="return doclink('link-196', 'send', 'link-23');">send</a></tt><tt class="py-op">(</tt><tt class="py-name">reply</tt><tt class="py-op">)</tt> </tt>
<a name="L328"></a><tt class="py-lineno">328</tt>  <tt class="py-line">        <tt class="py-keyword">del</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">sessions</tt><tt class="py-op">[</tt><tt class="py-name">request</tt><tt class="py-op">.</tt><tt id="link-197" class="py-name"><a title="xmpp.simplexml.Node.getTagAttr" class="py-name" href="#" onclick="return doclink('link-197', 'getTagAttr', 'link-22');">getTagAttr</a></tt><tt class="py-op">(</tt><tt class="py-string">'command'</tt><tt class="py-op">,</tt><tt class="py-string">'sessionid'</tt><tt class="py-op">)</tt><tt class="py-op">]</tt> </tt>
</div></div><a name="L329"></a><tt class="py-lineno">329</tt>  <tt class="py-line"> </tt><script type="text/javascript">
<!--
expandto(location.href);
// -->
</script>
</pre>
<br />
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">
  <!-- Home link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="xmpp-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

      <th class="navbar" width="100%"></th>
  </tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="100%%">
  <tr>
    <td align="left" class="footer">
    Generated by Epydoc 3.0beta1 on Sat Dec 15 22:25:20 2007
    </td>
    <td align="right" class="footer">
      <a href="http://epydoc.sourceforge.net">http://epydoc.sourceforge.net</a>
    </td>
  </tr>
</table>

<script type="text/javascript">
  <!--
  // Private objects are initially displayed (because if
  // javascript is turned off then we want them to be
  // visible); but by default, we want to hide them.  So hide
  // them unless we have a cookie that says to show them.
  checkCookie()
  // -->
</script>
  
</body>
</html>
